File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Opening new JSP page with parameters of parent page. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Opening new JSP page with parameters of parent page." Watch "Opening new JSP page with parameters of parent page." New topic
Author

Opening new JSP page with parameters of parent page.

Zak Nixon
Ranch Hand

Joined: Sep 27, 2003
Posts: 126
<nods head>
I have two pages, one called Search.jsp and DisplayResults.jsp.
Search.jsp collects all the information that a user wants to search
for, and after they press a 'search' button, the DisplayResults.jsp
displays the search results. This means that all of the data that
I collected within the search page needs to be sent to the
results page.
I have an initial idea, does it work?
window.open("DisplayResults.jsp?....(all of the parameters collected within Search.jsp");
is there a simpler way of sending all of the parameter collected within
search.jsp to displayresults.jsp?
Thanks
Zak Nixon
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50677

Since you can only stuff so much on the URL, you could run into a problem if the list of params gets long.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Zak Nixon
Ranch Hand

Joined: Sep 27, 2003
Posts: 126
Is there a limit on the number of parameters a URL can have?
Also, do you have a possible solution to my problem?
THanks
Zak
Jeffrey Hunter
Ranch Hand

Joined: Apr 16, 2004
Posts: 305
You are most likely collecting the user information with a FORM? Why not just submit the form to the displayResults.jsp?
Example:

Then you just have a button which will submit the form. Ideally, you'd want to submit the form to a Servlet, which grabs the results from the database, then forwards these results to the proper page for display.
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50677


Is there a limit on the number of parameters a URL can have?

No, but there is a limit on the number of characters, and more params means more characters.
Why not just submit the form to the displayResults.jsp?

I believe the problem is that he wants displayResults.jsp to appear in a new window rather than the same window as the submitting JSP.
What I believe you can do is to, using a submit handler, open a window using window.open, assign it a name, and use that name in the target attribute of the form.
In any case, this has ceased to be a JSP question and is now a Javascript question, so I'm going to move this over to the HTML/Javascript forum for further discussion.
Zak Nixon
Ranch Hand

Joined: Sep 27, 2003
Posts: 126
Ok,
I have the following:

My form is on a page called SearchRecords.jsp, and my form is called
searchForm.
Whenever the submit button is pressed, test() runs successfully, but
pops up DisplayResults.jsp (no params passed) and another page
which is my SearchRecords.jsp page with all the parameters.
Can someone lead me in the right direction?
Thanks
Zak
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15003
look at this code:
http://obiewebsite.sourceforge.net/obie.php?Submit_a_form_to_a_popup
Eric
Zak Nixon
Ranch Hand

Joined: Sep 27, 2003
Posts: 126
Eric, Eric, Eric.....
You have made my day so much easier!
Thank you SO MUCH for helping me out.
JAVARANCH KICKS REAR!!!


Zak Nixon
 
 
subject: Opening new JSP page with parameters of parent page.
 
Threads others viewed
modular struts-config.xml
problem in forward()
JSPs, Servlets and iFrames
Problem with Tiles
JQuery and JSP invocation
developer file tools