如何实现相当于的功能Struts 2 中的标签?
我正在将应用程序从 Struts 1 迁移到 Struts 2。
在 Struts 1 中,我们有
标记来绕过表单 bean 的 validate()
方法点击。
但在 Struts 2 中,我不知道有任何类似的标记可用,并且我的 Action
类中有一个 validate()
方法,如果您按下,该方法会自动执行提交按钮。
那么,如何将以下标签迁移到 Struts 2 呢?
<html:cancel property="cancel" value="No"/>
I'm migrating an application from Struts 1 to Struts 2.
In Struts 1, we have <html:cancel>
tag to bypass the form bean's validate()
method upon clicking.
But in Struts 2, I'm not aware of any similar tag available, and I have a validate()
method in my Action
class, which automatically gets executed if you press the submit button.
So, how do I migrate the below tag to Struts 2?
<html:cancel property="cancel" value="No"/>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
AFAIK,
validation
拦截器是一个方法过滤拦截器,默认情况下它会过滤一些方法名称,例如cancel()
。如果没有,那么您可以使用excludeMethods
参数。如果您像这样命名操作方法并将其映射到按钮,它将从验证中排除。详细信息位于我的答案此处。
AFAIK, the
validation
interceptor is a method filter interceptor and by default it filters some method names likecancel()
. If it doesn't then you can useexcludeMethods
parameter.If you name your action method like this and map it to the button it will exclude from validation. The detailed information consists in my answer here.