user3214811
user3214811

Reputation: 51

Struts 2.3 form with multiple submit tags with action attribute doesn't work

I have a form like this:

<s:form>
<s:submit action="act1"  />
<s:submit action="act2"  />
</s:form>

on generated html i have :

<input type="submit" name="action:act1">
<input type="submit" name="action:act2">

Now with struts2.3 it doesn't work but with struts 2.0 its all ok.

The log says that the parameter: action:act1 is in the excludeParams

The problem is in params interceptor: on the defaultStack i version 2.3 there is a filter like ^action:.* for interceptor params interceptor.

struts-default-xml:

<interceptor-stack name="defaultStack">
<interceptor-ref name="exception"/>
<interceptor-ref name="alias"/>
<interceptor-ref name="servletConfig"/>
<interceptor-ref name="i18n"/>
<interceptor-ref name="prepare"/>
<interceptor-ref name="chain"/>
<interceptor-ref name="scopedModelDriven"/>
<interceptor-ref name="modelDriven"/>
<interceptor-ref name="fileUpload"/>
<interceptor-ref name="checkbox"/>
<interceptor-ref name="multiselect"/>
<interceptor-ref name="staticParams"/>
<interceptor-ref name="actionMappingParams"/>
<interceptor-ref name="params">
<param name="excludeParams">^dojo\..*,^struts\..*,^session\..*,^request
\..*,^application\..*,^servlet(Request|Response)\..*,^parameters
\..*,^action:.*,^method:.*</param>
</interceptor-ref>
<interceptor-ref name="conversionError"/>
<interceptor-ref name="validation">
<param name="excludeMethods">input,back,cancel,browse</param>
</interceptor-ref>
<interceptor-ref name="workflow">
<param name="excludeMethods">input,back,cancel,browse</param>
</interceptor-ref>
<interceptor-ref name="debugging"/>
<interceptor-ref name="deprecation"/>
</interceptor-stack>

What can i do ? thanks

Upvotes: 3

Views: 1460

Answers (1)

Uchenna Nwanyanwu
Uchenna Nwanyanwu

Reputation: 3204

You need to edit your struts.xml file. Add the following line to it

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

Upvotes: 4

Related Questions