views:

184

answers:

2

I have one "user search" portlet on the home page of one application running on websphere portal server which displays the matching user records as per the search criteria filled in the search form. I have a requirement to have a "back to search input" link on the results page which on click should show the filled form on the input jsp.

The issue I am facing is if I open the application in two different tabs of same IE browser and start giving some search criteria and submit and at same time search for some other input from the other IE tab (in the same browser) and then go back to previous tab and click on "back to search input" link, instead of showing me the first input it will show me the input I entered in the next IE tab.

I am setting and getting the bean (form bean) through portlet session. But in the two diff tabs of the same IE it will be the same user session (and may be the same portlet session.)

How can I fix it so the two tabs save their search results independently?


The one thing to note here is I can access this "user search" application without logging in. So it must be taking the default portlet session in this case. What will happen once I login and then search; will it overwrite the portlet session and http session?

+2  A: 

Basically your issue stems from the fact that your session is the same in both tabs so any data you store you can't expect to be different between tabs unless you store it as such. I would assign each search an id and store them in a collection in your session. Then when you draw your "back to search input" button add the search id such that you can pull the correct search out when building the input page.

Alternatively you could save server memory by posting the search as a query string on the return to search link rather than storing it in session.

Jonathan Park
Hi thanks for the information.Could you please explain a bit more about how to add the search id to the "back to search input" link and how to identify the search id on my form jsp.if u can provide any example then it would be great for me.
ha22109
A: 

What you describe is a fairly common problem faced by web app -- I think the official term is conversations -- which is the need to support something in-between the session scope and the request scope.

Some web framework support this concept, some not. The portlet specification does not support that out-of-the-box (Maybe there's something specific in websphere though).

I think one way to re-create the support for conversations, is to store a conversation id in the HTML generated. This way you can have an ID that is be per-tab / window. If suddenly a request receive an old ID, you know it comes from either an old page (if the user used the back button), or another tab.

That's ony a rough sketch. I'm pretty sure there a good resources on the web about this problem, otherwise spawn another question.

ewernli