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

dynamic form processing

Dave Kinkead
Greenhorn

Joined: Feb 22, 2003
Posts: 13
I want to be able to process form data dynamically based on what selection a user makes but am unsure of whih approach to take.
Basically, I want to have a form with 2 or 3 submit options. On submit, the form data is forwarded to the appropriate servlet depending on which submit button was clicked.
How would I do this - can I add some variable to the <form action="/servlet/???"> tag or is it possible to have the individual button forward the form data to a location based on the button's value?
Thanks in advance
Dave
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61601
    
  67

Dave, either approach is viable.
If the server-side form processing is similar for the various situations, I think it'd be best to set a hidden parameter on the form that the servlet (or whatever's doing the form processing) can use to adjust the processing accordingly.
If the processing will be different for each case, you can modify the action attribute of the form to specify completely different servlets.
Which approach you take depends upon what makes the most sense for your app.
In either case, this is purely an HTML/Javascript operation, so we might want to move this dicussion here.
hth,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Raghunandhan Ramanujam
Greenhorn

Joined: Jun 23, 2003
Posts: 10
Using the button's value seems to be a cleaner option
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: dynamic form processing