How to tell from what request user comming from (in this situation)?
Hello!I got a problem to find out a solution to this problem.
Let me first describe the "environment".
I got a webapp in struts, that we should redesign.
The webapp got a menu that follows every page (no frames, hiermenus.js).
From the menu the user can access page search.jsp, a path through the struts framework.
The search.jsp contains a form.
When submitting the form a page result.jsp shows.
(The menu is visible all the time)
At the result page there is also a back-button, back to the search.jsp.
This back button is used at many places in the webapp and use javascript with history.back().
The struts setup looks like:
<!--Entry to the search form-->
<action path="/Search"
type="myapp.SearchAction"
name="SearchForm"
scope="session"
validate="false">
<forward name="Result" path="/search.jsp"/>
</action>
<!--Entry to the result page-->
<action path="/Result"
type="myapp.SearchAction"
name="SearchForm"
scope="session"
validate="true">
<forward name="success" path="/result.jsp"/>
<forward name="failed" path="/search.jsp"/>
<forward name="nohit" path="/search.jsp"/>
</action>
My conclusion between the menu and the back button is that the request is always the same.
The task is that if the user enter the the search from the menu (at any time), the search-form should be "empty".
If the user enters the search form from the back button (history.back()) the search-form should be populated with
previous data.
The problem is then how can I differentiate the request from the menu versus the back-button?
If I can determine the request I can remove the form from the session in the ActionClass before returning the search form.
I have created a sketch that I hope you can access and see:
http://eunywq.blu.livefilestore.com/y1p2ScdmAKhhAC0dFk2IDmnEbrhj-6F2n0Lod37DtyA-RMJvfuNCLF4nLxB3tHgiIp_LAyZZS7RrxrGqcKUiRIkNY09yR_evRVJ/search.png
Any ideas are most welcome!
Best regards
Fredrik
