aspose file tools*
The moose likes JSP and the fly likes form and jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "form and jsp" Watch "form and jsp" New topic
Author

form and jsp

Aris Doxakis
Ranch Hand

Joined: Dec 05, 2004
Posts: 136

Hello,
I am trying to find a way to call a servlet from 2 diffrent searches in my site using only 1 form.Is that possible??
In specific i have a bookstore and i also have 2 kind of searches,one advanced with title and author,and one by category.How can i call a servlet(search) with using only one form..is that possible...
thnx in advance...
Travis Hein
Ranch Hand

Joined: Jun 06, 2006
Posts: 161
so you have two different html input forms , one with title and author, and the second with category and you want them to be able to use the same servlet to do searching.

A hidden input field inside the forms could be used to tell the search Servlet which input form was used to invoke the servlet, and then the servlet would inspect the request parameters for the this hidden property to know what input fields to expect and how to run the search.

for example,



Error: Keyboard not attached. Press F1 to continue.
Aris Doxakis
Ranch Hand

Joined: Dec 05, 2004
Posts: 136

thnx it was that simple..i was trying way wrong.i thought i couldn't have 2 forms with the same name in the same jsp page..
thnx again..
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Actually you should give them different names, but set the same action.


[My Blog]
All roads lead to JavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: form and jsp