Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
382 views
in Technique[技术] by (71.8m points)

java - Struts2: multiple submit button

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>

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?

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

Read more on Security Bullettin S2-018.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...