aspose file tools*
The moose likes Struts and the fly likes Struts forward problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts forward problem" Watch "Struts forward problem" New topic
Author

Struts forward problem

James Zhang
Ranch Hand

Joined: Sep 06, 2002
Posts: 30
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
 
subject: Struts forward problem