Solved

Reloading the jsp page

Posted on 2003-11-03
2
252 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
Comment Utility
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 50 total points
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

HOW TO: Install and Configure VMware vSphere Hypervisor 6.5 (ESXi 6.5), Step by Step Tutorial with screenshots. From Download, Checking Media, to Completed Installation.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now