1

使用 javascript 的客户端验证或使用 struts 验证器框架的服务器端验证更安全和更有利的是什么..??? 我正在开发电子商务应用程序

4

2 回答 2

1

你不能比较两者,因为它们都有不同的范围和用例

我强烈建议同时使用两者,客户端验证更多地以用户为中心,并向用户显示一些一般错误,但不为用户输入提供深层次的数据检查。

在触发任何有助于保持数据一致性的业务逻辑之前,请继续进行服务器端验证。

于 2012-07-24T07:15:15.790 回答
0

Based on What is more secure and advantageous, i will suggest you use JSR 303 bean validation. You annotate your entities or beans with annotations like @NotNull etc and use this Hibernate Validator plugin for Struts 2. You can now replace the validation interceptor with the interceptor this plugin provides. This is both advantageous in terms of not repeating yourself and not dealing with numerous validation xml files.

于 2012-07-24T07:57:07.300 回答