Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

form and jsp

 
Aris Doxakis
Ranch Hand
Posts: 136
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,

 
Aris Doxakis
Ranch Hand
Posts: 136
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually you should give them different names, but set the same action.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic