Retaining page again
HI all,
Iam doing a search filter module using jsp.After selecting the user inputs available,if a user submits the page the results will be displayed.But now i want to retain the page with same selected criterias so that he can modify the criterias.This should be done by giving a back button in the search output page.How to retain the values in the select input page after the back button is clicked in the output page.Hope you understand my issue
Any ideas guys.
Regards,
Karthik
[514 byte] By [
KarthikMa] at [2007-11-26 15:01:21]

# 2
Another way to do it is to store them in the session as name value pairs. But there are some drawbacks with using sessions, sessions get timed-out after a set interval, sessions don't work in browsers that disable cookies (a rare case)
# 5
Hi,I tried in that way,but still its giving probles.In my inout screen i used DHTML for adding dynamic rows.So its very hard to handle that.Hope u got it.My concern is ,Is it the only way to achieve that ? Or else any new ideas?Thanks for ur
# 6
Use sessions.
First create a HashMap of Field Names, and Field Values then store that HashMap in the session.
Then read the HashMap from the session and get the Field Values from the Field Names.
Are you doing this with JSP Tag Libraries, or are you doing this with JSP Scriplets.
Depending on which approach you take (JSTL is the better approach), the code will look different.
# 7
Hi KarthikM,
Hmm I think you should put your criteria in some wrapper like HashMap (just like other person said) or use queryString (yourJSPfile.jsp?search=myBook&sort=asc)
that will be good enough! and to access it by using scriplet in your JSP like this
<form name="form" action="toYourServlet" method="post">
<input type="input" name="search"/>
<input type="input" name="sort"/>
<input type="submit" value="search"/>
</form>
<% if ( request.getParameter( "search" ) != null )
// do all operation that you need to display the search result
%>
and in the servlet processing you should redirect to the jsp with query string(yourJSPfile.jsp?search=myBook&sort=asc)
but this method has weakness you cant dispatch it... you can only redirect to the jsp... If you really want to dispatch... use request.setAttribute and getAttribute! I hope my answer can help you!
From wizz