0

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.

Roman C
  • 49,761
  • 33
  • 66
  • 176
Shantaram Tupe
  • 1,646
  • 3
  • 16
  • 42

1 Answers1

0

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">
Roman C
  • 49,761
  • 33
  • 66
  • 176
  • Yes I know result name `input` is returned, but How to find for which **parameter** I'm having problem..? ty for reply – Shantaram Tupe Nov 30 '16 at 12:58
  • I already, have this line in my xml `process_solution_list.jsp` – Shantaram Tupe Nov 30 '16 at 13:00
  • the parameter is the same which is sent to the action, you populate it to the action and it's available in JSP from the value stack. – Roman C Nov 30 '16 at 13:01
  • in my action `delete-process-solution` i'm using `type="redirectAction"` for result `name="success"`, I think my request parameters are **lost** , **How to continue with request after `redirectAction` ?** – Shantaram Tupe Nov 30 '16 at 14:05
  • After `redirectAction` result you don't need any parameter, but if you have some other parameters that should persist on the list view then use `redirect` result. – Roman C Nov 30 '16 at 21:47
  • @shantaram You can exclude the action method from validation. – Roman C Dec 14 '16 at 13:33