wood burning stoves 2.0*
The moose likes Struts and the fly likes Search queries... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Search queries..." Watch "Search queries..." New topic
Author

Search queries...

Gilbert Debattista
Greenhorn

Joined: Apr 05, 2005
Posts: 19
I'm developing an advanced search page for a web application I'm currently working on. Everything's gone fine till i came to pass the query parameter from one page of the results to another. How can I do this without passing the query as a parameter (thus exposing the dynamic query to the user) ? I've temporarily solved the issue by saving the query as an attribute in the session however I don't think this is an appropriate solution considering that a large number of clients will be accessing the search page.
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
I hope I understand you question correctly, but can't you enlose your search parameters(i.e. drop down list(s), text boxe(s)) in a form document and set the method attribute to "POST". This will store your search parameters inside the request object instead of request parameters of your url.
Gilbert Debattista
Greenhorn

Joined: Apr 05, 2005
Posts: 19
Originally posted by Craig Jackson:
I hope I understand you question correctly, but can't you enlose your search parameters(i.e. drop down list(s), text boxe(s)) in a form document and set the method attribute to "POST". This will store your search parameters inside the request object instead of request parameters of your url.


That's ok for posting the first time your search criteria. However I have implemented a paging system to page my results such that they don't appear in one single page (try to imagine hundreds of results). So I need to find a way to keep the search criteria, which was originally posted using a form etc..., while I change my limit and offset of my query to the db in order to get the search results of a particular page.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
As I see it, you have 3 main viable choices:

  • put a property for the query in your form bean, and in each jsp, put a hidden field for the query on the page. This will pass the query from page to page without it appearing as part of the URI.
  • Put it in the HTTPSession. If it's just one string, I don't see it as a big scalability issue to store it in the session, even for thousands of users. Obviously, if you're doing horizontal scaling, your app server will have to have a means of preserving the session across multiple instances of the app server.
  • Store it in a cookie on the browser.


  • Merrill
    Consultant, Sima Solutions
    sreenath reddy
    Ranch Hand

    Joined: Sep 21, 2003
    Posts: 415
    Hi

    Its better to store all the search paramters in the form bean and make the scope of that as session ....just java bean in session wont hamper any performance and the effort u need to spend in resending the data for the search will be more if u wont store that in session

    Regards
    Sreenath
    Gilbert Debattista
    Greenhorn

    Joined: Apr 05, 2005
    Posts: 19
    Originally posted by Merrill Higginson:
    As I see it, you have 3 main viable choices:

  • put a property for the query in your form bean, and in each jsp, put a hidden field for the query on the page. This will pass the query from page to page without it appearing as part of the URI.
  • Put it in the HTTPSession. If it's just one string, I don't see it as a big scalability issue to store it in the session, even for thousands of users. Obviously, if you're doing horizontal scaling, your app server will have to have a means of preserving the session across multiple instances of the app server.
  • Store it in a cookie on the browser.


  • I have decided to leave the search string in the session. I did some research on how much maximum memory my string was going to take and found out that it was quite small to be bothering about it. Thanks all for your help :-)
     
    wood burning stoves
     
    subject: Search queries...
     
    Similar Threads
    searching program in LDAP
    How to get results into same jsp
    ResultSet is closed??
    Why do I love using firefox.
    Lucene 1.9.1 indexing keywords