验证过程不是在 Struts 2 的服务器端工作吗? [英] Isn't validation process working on the server-side in Struts 2?

查看:45
本文介绍了验证过程不是在 Struts 2 的服务器端工作吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 Struts 中的验证概念感到困惑.ActionSupport 类提供了 validation() 方法

I get confused with the concept of validation in Struts. ActionSupport class provides the validation() method

public void validate(){}

用于验证表单.但是这个过程不是在服务器端工作吗?

which is used to validate the form. But isn't this process working on the server- side?

如果是这样,是否不符合验证的概念?

If it is then, is it fails the concept of validation?

推荐答案

问题不清楚.

是的,动作的 validate() 方法显然在服务器端验证.

Yes, an action's validate() method obviously validates on the server side.

这是一件好事,因为数据必须在服务器端进行验证,无论是否发生任何客户端验证.考虑 (a) 禁用 JavaScript 的用户,以及 (b) 不是通过浏览器发出的手工请求.虽然 (a) 越来越不常见,(b) 是合法的危险.

This is a Good Thing, because data must be validated on the server side, regardless of whether or not any client-side validation occurs. Consider (a) users that have JavaScript disabled, and (b) hand-crafted requests not made through a browser. While (a) is increasingly uncommon, (b) is a legitimate danger.

您不能依赖仅 JS 的验证.

You cannot rely on JS-only validation.

这篇关于验证过程不是在 Struts 2 的服务器端工作吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆