• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts forward problem

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
You ridiculous clown, did you think you could get away with it? This is my favorite tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic