This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Search queries...

 
Gilbert Debattista
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 405
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

  •  
    sreenath reddy
    Ranch Hand
    Posts: 415
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 19
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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 :-)
     
    I agree. Here's the link: http://aspose.com/file-tools
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic