• Post Reply Bookmark Topic Watch Topic
  • New Topic

One managed session bean for 'each' result window - possible with JSF?  RSS feed

 
jack catler
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This probably relates to servlet/jsp just as much as JSF - but here goes anyway.

My application allows the user to open a number of search windows (i.e. they can right click - new window). The result of the search creates a result object which needs session scope so they can sort the result, stick in shopping basket, and other actions.

What is the best way to assign/keep a specific session scoped result bean to the SPECIFIC jsp page ?

Can you exit with a parameter/status so the jsp page will embed a type of ID a thus create the mapping? What does the JSF navigation allow ?

Many thanks
 
Gerardo Tasistro
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about if you have a session scope bean with a map of search classes. When a new page is opened the JSP (using a request scoped bean) requests a new query to the session bean (this requires syncronized access). The session bean creates a new node in the map and returns the key and search object. The request then places the key in a hidden field inside the JSP and links the search fields with the search object (kinda like a data bean). The user then fills the form and posts. A new request gets generated. It sees that the query ID exists as a hidden field so it doesn't generate a new one. It then passes the search object to the session bean to be processed. The session bean does the query, updates the map and returns the results in the same query object. The request updates the view accordingly.
 
jack catler
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.

So you are suggesting a pool of session objects dished out as requested and ID keys to these objects in a hidden field on the JSP page - and thus enable the linkage of the two? Sounds reasonable and I guess it should work.

I guess I could set a limit on the size of the pool, and use a LIFO for picking the victim object when a new request comes in and the pool is used.

I am most curious to know if this (or a deviation of this) is the general solution most people use? I imagine this problem is not unique to myself or JSF, how do others handle a user opening new windows on the same session and referencing the same session objects from these different windows?

Thanks again.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!