Pracede
Pracede

Reputation: 4361

Struts 2 - Generated form action

I create a form with Struts 2, using the following code :

<s:form id="form" onSubmit="getParameters();">

I don't understand why the generated is the following one :

<form id="form" name="form" action="/Projet/ListAction.action" method="post" onSubmit="return getParameters();">

Here is my struts.xml

 <action name="ListBrochures" class="fr.web.actions.ListAction" method="execute">
    <result name="success">listAction.jsp</result>
  </action>

Why i have an action called ListAction.action. My aim is not to submit the form but to send a Ajax request. So as this action is called before my Ajax call, this bring trouble in my project. I just want that Struts does not generate the action in my form. I did not specify any action. Thanks for helping.

Upvotes: 1

Views: 1714

Answers (1)

Pigueiras
Pigueiras

Reputation: 19356

If you look at the documentation (parameter action), if you don't set any action in your <s:form> tag, the action that struts2 take will be the current action.

Upvotes: 1

Related Questions