Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Reloading the jsp page

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Running Java Servlet inside Eclipse Luna 6 163
default methods vs abstract class 1 118
Set up Wildfly 10 8 422
eclipse buid path vs tomcat lib path 10 34
IT certifications are a concrete representation of continual learning on the part of the candidate.  Continual learning is necessary for the long term success of an IT professional, but are IT certifications the right path for you?
This article describes how to reset your Windows 10 password when you've forgotten it.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

860 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