This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes HTML, CSS and JavaScript and the fly likes choose the servlet a form should do Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "choose the servlet a form should do" Watch "choose the servlet a form should do" New topic
Author

choose the servlet a form should do

Daniel Gultom
Greenhorn

Joined: Aug 01, 2007
Posts: 6
i have a form that need to choose which servlet the action on form should do.

for example, if i click button1, the form action is button1servlet
if button2, the form action is button2servlet.
how to do this using jsp.
furthermore, along with choosing the right form for the right button, i need
to pass a parameter. i am thinking about using
<form action=button1servlet?ID = 5> and get it using request.getParameter("ID") from the button1servlet. can it be done?

Thank you for your answer.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41599
    
  55
One way would be to set the form's action attribute when one of the buttons is pressed.

And yes, you can pass parameters in the action attribute.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: choose the servlet a form should do