File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts forward problem

 
James Zhang
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know if this problem has been discussed before or not, but there is my problem: I have two actions, action1 and action2, with corresponding forms (form1 and form2) and jsp files (jsp1 and jsp2). Both jsp1 and jsp2 contains a submit button, so I defined the same property "submitButton" in both form1 and form2 for the button.

The process flow should be that user clicks submit on jsp1, action1 will do some work, and then forward to action2, and action2 will do some initialization work and display jsp2. The struts-config.xml would look like:

<action path="/action1" scope="request"...><forward name="submit" path="/action2" /></action>
<action path="/action2" scope="request"...><forward name="submit" path="/action3" /></action>

The problem is that since I give the same property submitButton for both form1 and form2, so when action1 forward to action2, action2 always find the property submitButton of form2 to be not null! Therefore, action2 forwards again to action3 just like user also clicks the submit button on jsp2!

I know the problem will disappear if I give different names for the submit button in form1 and form2, but this is really not a good workaround.

Does anybody solve similar problem before?

Thanks in advance,

James
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic