struts2编辑页面验证?
我有一个包含用户个人资料的表格,下面我给出了一个按钮(编辑个人资料),用户可以通过该按钮更新他/她的个人资料,当用户单击“编辑个人资料”时,将显示一个新页面,其中包含所有内容用户的信息,它是从数据库中填充的。
我面临的问题是,在此页面中没有进行验证,假设用户删除了他的用户名并尝试更新他的个人资料,它应该显示 * 用户名是必需的 相反,它抛出了一些错误,我填充验证在这里没有发生,因为数据来自数据库,但我不确定,任何人都可以帮助我。
I have a table which contains the profile of the user and below that i have given a button(Edit Profile) through which the user can update his/her profile, when a user click the Edit Profile a new page will be displayed which contains all the information of the user and it is populated from the database.
The problem i am facing is that validation is not happening here in this page, say a user delete his user name and tries to update his profile it should show * User Name is required
instead of that it is throwing some error, i fill validation is not happening here because the data are coming from the database but i am not sure, can anyone help me in this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于您没有发布任何代码,我不确定您正在使用什么验证方法或您尝试过什么。以下是使用
validate()
方法处理表单验证的示例操作。我最初忘记提及您需要更改表单,以便它提交到“myAction!submit”而不仅仅是“myAction”。
Since you didn't post any code, I'm not sure what method of validation you are using or what you have tried. Here's an example action using the
validate()
method to handle form validation.I originally forgot to mention that you will need to change for form so that it submits to "myAction!submit" rather than just "myAction".