Reputation: 1666
I have following code snippets:
From struts.xml
:
<action name="list-process-solution" class="actions.ProcessSolutionAction" method="listProcessSolutions">
<interceptor-ref name="store">
<param name="operationMode">RETRIEVE</param>
</interceptor-ref>
<interceptor-ref name="defaultStack"/>
<result name="success">process_solution_list.jsp</result>
<result name="input">process_solution_list.jsp</result>
<result name="error">Error.jsp</result>
<result name="login">Login.jsp</result>
</action>
<action name="delete-process-solution" class="actions.ProcessSolutionAction" method="crudProcessSolution">
<interceptor-ref name="store">
<param name="operationMode">STORE</param>
</interceptor-ref>
<interceptor-ref name="defaultStack"/>
<result name="success" type="redirectAction">
<param name="actionName">list-process-solution</param>
<param name="nsec">${nsec}</param>
</result>
<result name="error">Error.jsp</result>
<result name="login">Login.jsp</result>
</action>
After deleting I'm redirecting to List Page ( same again Page )
But I'm getting result as INPUT
don't know where I'm wrong.
I have configured this link for delete:
<s:url var="varDeletePS" action="delete-process-solution">
<s:param name="nsec">
<s:property value="nsec"/>
</s:param>
<s:param name="processId">
<s:property value="processId"/>
</s:param>
<s:param name="opType">
<s:property value="2" />
</s:param>
</s:url>
<s:a href="%{varDeletePS}" id="id-delete-PS-link" cssClass="class-delete">
Delete
</s:a>
In action, I have these fields with getters and setters:
private ProcessSolution processSolution;
private short opType;
private String nsec;
For Model ProcessSolution
refer this link
My Question is:
How to handle result name INPUT
here ? I don't know which parameter is wrong ?
Update :
How to continue with same request after redirectAction
, so I will have my request parameters ?
How to identify which field having error ?
UPDATE 2 :
My delete-process-solution
executing properly but on result SUCCESS
, and redirectAction
to list-process-solution
, I'm getting result as INPUT
.
Upvotes: -1
Views: 1517
Reputation: 1
INPUT
result is returned if you have validation errors. Create validation method prefixed for each action in the action class and add INPUT
result to the action config.
<result name="input">Login.jsp</result>
You might have validation errors which results INPUT
, but the action is not executed and message isn't set. If you want to prevent the action from validation you can configure the action to exclude the method from validation
interceptor or use the solution above.
As far as validation
interceptor implements a method filter interceptor you can do it in struts.xml
. Or just add @SkipValidation
annotation on the method.
@SkipValidation
public String crudProcessSolution(){//used this method for delete
//<action name="delete-process-solution" class="actions.ProcessSolutionAction" method="crudProcessSolution">
Upvotes: 0