Hi all, I have a jsp search page (Search.jsp) and a result page (Result.jsp), both of them can choose search criteria. and then passed the parameters to a java controller file (Controller.java) to build a query string and performs query searching. The query string and searched results will be passed to Result.jsp for displaying.
Currently I use servletContext to remember the processed query string, and if users use Result.jsp to select search criteria, Controller.java will append such criteria to the existing query string. If I do a few searches using Result.jsp. For example, query string would display ((Query1) AND Query2) AND Query3
on the Result.jsp page. Then using the browser's back button to go back to the previous display page. For the same example, query string displays (Query1) AND Query2
. Then if I do search again. The query string (((Query1) AND Query2) AND Query3) AND Query4
would be used. I know this is expected with my current implementation since Result.jsp does not do any modification with the processed query string.
However, I would like when user uses the browser Back button, for example, query string displays on the page as (Query1) AND Query2
, and perform search, the query string should be ((Query1) AND Query2) AND Query4
in which the query string is build based on the current displayed query string on the Result.jsp page plus the current selection. How can I do that? It sounds quite simple but I have tried several ways of using the in Result.jsp to update the query string, but still couldn't get it right. Therefore I am wondering maybe my approach of using <c:set>
is wrong. I would like to hear your suggestion. Thanks in advance.