• 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

submit buttons in form

 
Ranch Hand
Posts: 375
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a jsp form looking like --

<s:form action="saveData">
.....

<s:submit value="save" action="saveData" name="submit"></s:submit>
<s:reset value="reset" name="reset"></s:reset>
<s:submit value="display" action="displayData" name="display"></s:submit>

</s:form>

I find that when I click the first button (save) the URL shows the /saveData.action.
But when I click the second button, I still see URL as /saveData.action, but the interesting thing is when I click the second button it is actually doing the right thing, which is displaying the data. I thought it is because I put the buttons inside the form and in the <form> attribute I already defined action="saveData". So I tried removing action="saveDat" in the <form> tag. After I did that, two buttons still did what are supposed to do. But when I clicked the first button it still saved Data but the URL shows the /displayData.

How can I insure that clicking the two buttons can both do the right logics and see the correct (desired) URL ?
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The URL that's displayed depends on the result configuration--if you're just doing a dispatch the URL won't change.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic