如何实现相当于的功能Struts 2 中的标签?

发布于 2025-01-11 03:49:36 字数 409 浏览 7 评论 0原文

我正在将应用程序从 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

春庭雪 2025-01-18 03:49:36

AFAIK, validation 拦截器是一个方法过滤拦截器,默认情况下它会过滤一些方法名称,例如 cancel()。如果没有,那么您可以使用 excludeMethods 参数。

如果您像这样命名操作方法并将其映射到按钮,它将从验证中排除。详细信息位于我的答案此处

AFAIK, the validation interceptor is a method filter interceptor and by default it filters some method names like cancel(). If it doesn't then you can use excludeMethods 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文