Wizard form in Struts

Posted by Kuntal Basu on Stack Overflow See other posts from Stack Overflow or by Kuntal Basu
Published on 2011-01-06T11:46:26Z Indexed on 2011/01/06 11:53 UTC
Read the original article Hit count: 441

Filed under:
|
|

I am creating a wizard in Struts. It cotains 4 steps. For Each step I have separate ActionClass say:-

  • Step1Action.java
  • Step2Action.java
  • Step3Action.java
  • Step4Action.java

and in each class there are 2 methods input() and process().

  • input() method is for showing the page in input mode
  • process() method is will be use for processing the submitted data (if validation is ok)

I am carrying all data upto the last step in a session. And saving all of them in database in the last step

Similaly 4 action tags in struts.xml like :-

    <action name="step1" class="com.mycomp.myapp.action.Step1Action1" method="input">                       
      <result name="success" type="redirectAction">step2</result>   
      <result name="input">/view/step1.jsp</result>     
    </action>

    <action name="step2" class="com.mycomp.myapp.action.Step1Action2" method="input">                       
      <result name="success" type="redirectAction">step3</result>   
      <result name="input">/view/step2.jsp</result>     
    </action>

But I think I am going wrong. Please Tell me How will I handle This case?

© Stack Overflow or respective owner

Related posts about java

Related posts about struts2