I have a Struts 2 application, In one of the pages I am using <sj:submit>
to submit the page with targets and errorElementId
attributes. I have used the Struts 2 validations on the
, and the result type are written, so that the success
will redirect to a <div>
, and the failure
will redirect the action to the same <div>
, using errorElementId
like the following
<div id="errorDiv" >
<sj:submit targets="successDiv" errorElementDiv="errorDiv" />
</div>
<div id="successDiv">
</div>
On testing this page, I am getting the success
response to the successDiv
, as given in the targets attribute, but in case of validation errors I am expecting the page to return to the same <div>
, where the sj
belongs, i.e. the errorDiv , but then also the page with validation errors are rendered in the
successDiv` like the following
the result types for the action are the following
<result name="success">jsp/process/processlist.jsp</result>
<result name="input">jsp/process/addprocess.jsp</result>
Can somebody tell me where I am going wrong.
This worked for me . It uses a an interceptor called jsonValidationWorkflowStack , which will return the validation errors , which are handled by javascript .