This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes 2nd ques. search/submit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "2nd ques. search/submit" Watch "2nd ques. search/submit" New topic

2nd ques. search/submit

Pranav Sharma
Ranch Hand

Joined: Oct 27, 2003
Posts: 258

i have another question.

I'am trying to search the database based on multiple fields.
for example in a library i can search a book by author, title and publishing company.
I want a single submit button.
Now if the user enters author and title, leaves publisher empty then hits submit.

How would i implement this functionality , i dont know if this is a struts specific question. but i would like to do it using struts(if possible)

Andy Hahn
Ranch Hand

Joined: Aug 31, 2004
Posts: 225
Well when you submit the form, you will be populating the form elements for those html text fields. Thus you can view those form parameters in your action class and use logic based on that data.
Pranav Sharma
Ranch Hand

Joined: Oct 27, 2003
Posts: 258
I guess little knowledge is a bad thing after all....
solution this simple, I did not even think about it.

Thanks Andy
It is sorta covered in the JavaRanch Style Guide.
subject: 2nd ques. search/submit
Similar Threads
Several Question Regarding the 97 Things... Book.
Struts 2 Validator Question
Need Instructions To Setup The Artimus Example
Book recommendation after finishing Head First
Tiles with the submit form