• 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

Submitting from "/a.do" to "/b.do"

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the following jsp codes:-



This form handles multiple user actions, and most of the actions are processed in "/a.do" action class itself. However, I do have a button where when user clicks, it will submit to "/b.do" to be processed...

So when user hits the submit button in the above "/a.do", is it possible to submit the form to "/b.do" and have the form fields mapped to the associated "/b.do" actionform?

Currently, my workaround is to have a forward key in "/a.do" pointing to "/b.do", and it works. However, since it is doing forwarding, the URL still shows "/a.do" instead of "/b.do", but the content is generated by "/b.do" action class.

Is there a way for the URL to show "/b.do" when user submits from "/a.do"?

I also tried creating a forward key in "/a.do" pointing to "/b.do", but have it as a redirect, but it seems like the request object doesn't have the "/a.do" form fields information after getting redirected to "/b.do".


Thanks much.
 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this:

<input type="button" value="The B form" on_click="document.forms[0].action='b.do';document.forms[0].submit();">

where .forms[0] points to your first form on the document
you could also use "document.forms.myFormName.action"
And the on_click must not have an underscore (The website does not like javascript submitted)
reply
    Bookmark Topic Watch Topic
  • New Topic