Do Struts tags <s:submit>
and <sj:submit>
work on same form? I have already Struts buttons <s:submit>
, but now I have added <sj:submit>
. So, Struts2-jQuery plugin button is working good, but Struts <s:submit>
is not working.
<head>
<sj:head/>
</head>
<s:form id="myForm" action="part!list">
<s:submit action="part" method="list" />
</s:form>
<sj:submit targets="result" formId="myform"/>
Please clarify ...
<s:submit>
works with the form if it's inside the body of the<s:form>
or<form>
tag. To make it work properly use theaction
attribute to map the form to the action. You could also use<s:url>
to build the url used in theaction
attribute of the form that correctly builds url even with parameters. But if you map the action in the<s:submit>
tag then you have to use only one attributeaction
ormethod
. These are special parameters used by the action mapper. In the first case formaction
will be overridden, in the second case the action method overridden. It means that the attributesaction
andmethod
in the<submit>
tag only used to override the default form action mapping. It's rarely used, requires DMI, if you have multiple buttons that have different methods consider to use themethod
attribute to override the form action mapping.EDIT:
Example
the above
s:submit
in the first case use actin namedpart2
to submit to, the second action namepart
and methodlist2
, the third is default action namepart
and methodlist
Ajax calls like the third case.If your action is mapped on the method
list
, then you could simplify the url via