Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Reloading the jsp page

Posted on 2003-11-03
2
Medium Priority
?
274 Views
Last Modified: 2010-04-01
Hello,
    I have a problem in my code. Let me explain the scenario.
   I have a search button in a search.jsp page. when I click the search button I will be posting it to the controller /usr/search. When I come  back to the user search page. I need to display the search criteria entered by the user. there are 10 search criteria text boxes. with username. last name etc
  So how do I cache the search criteria?
To cache the criteria information
    I took the approach of setting up a session variables in another jsp page when the user clicks the search button. here is the code of the two pages
This is the another page where i'm setting the session variables
<%
   session.setAttribute("username_criteria", request.getParameter("usernames"));
   session.setAttribute("user_last_name_criteria", request.getParameter("user_last_names"));
   session.setAttribute("user_first_name_criteria", request.getParameter("user_first_names"));
   session.setAttribute("user_status_criteria", request.getParameter("user_status"));
   request.setAttribute("search_criteria_flag", "true");
%>  

Here is the javascript code where i'm submitting the pages

function searchUsers() {
       forward(document.userSearchForm,"/security/user/search_criteria.jsp","/user/user_search.jsp","/user/user_search.jsp");
               
forward(document.userSearchForm,"/security/usr/search","/user/user_search.jsp","/user/user_search.jsp");

}

forward is a javascript function which is used to submit a post to the pages which is passed as a parameters

the problem with this approach is sometimes it submits only the second one. sometime both the submits

How do I solve this problem.?Someone help me out solving this problem
0
Comment
Question by:ragtan
2 Comments
 
LVL 4

Expert Comment

by:kokchoon78
ID: 9691094
y u use java script to post your form ? u can post a form by action attribute in the html form tag, right ?

<form action="/user/user_search.jsp" method="POST">
...
...
</form>

Or, maybe u have your reason ?
0
 
LVL 6

Accepted Solution

by:
jarasa earned 200 total points
ID: 9778418
Try this:
var params = genParams(); // you have to take the form to resend it in post mode
params += "Extra information if you have ";
var url = "your servlet or jsp" + params;
window.location.href=url;
Have Fun
Javier
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to fix a SonicWall Gateway Anti-Virus firewall blocking automatic updates to apps like Windows, Adobe, Symantec, etc.
This article will show you step-by-step instructions to build your own NTP CentOS server.  The network diagram shows the best practice to setup the NTP server farm for redundancy.  This article also serves as your NTP server documentation.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question