Solved

Reloading the jsp page

Posted on 2003-11-03
2
259 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 50 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
spring AOP 6 91
Java Script nested call 3 88
How can I   ajax html table  rows? 20 79
HTTPSessionBindingListernter not configured in deployment descriptor 2 70
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…

685 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