Struts2:多个提交按钮 [英] Struts2: multiple submit button

查看:80
本文介绍了Struts2:多个提交按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的jsp中有2个提交按钮,所以我找到了本教程:

I would like to have 2 submit button in my jsp, so I found this tutorial: http://struts.apache.org/release/2.3.x/docs/multiple-submit-buttons.html I want to develop the Nyong Nyong's solution with MyBaseAction class, extended by MySubmitAction and MyClearAction class. But I can't get it work. I'm not sure how the jsp will be, this is in the example:

<s:form method="post" action="mySubmitAction">
    <s:submit value="Submit"/>
    <s:submit value="Clear" action="myClearAction"/>
</form>

但是我想它是指前面的例子. 我不太清楚struts.xml,是否需要设置一些特定的常量值或其他内容?

But I suppose that it's referred to the previous example. I'm not sure too about the struts.xml, do I need to set some specific constant value or other stuff?

如果有人可以提供完整的jsp和struts.xml示例,那就太好了.

Would be great if somebody could provide a full jsp and struts.xml example.

推荐答案

如果您在2.3.15.2之前的版本更新中使用struts,则必须将此常量添加到struts.xml中以启用action:前缀:

If you are using struts in a version newer than 2.3.15.2, you must add this constant to struts.xml to enable the action: prefix:

<constant name="struts.mapper.action.prefix.enabled" value="true" />

因为默认情况下它已被禁用.

because it has been disabled by default.

详细了解安全公告 S2-018 .

Read more on Security Bullettin S2-018.

这篇关于Struts2:多个提交按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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