This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes how to transfer Object or request between jsp??help?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "how to transfer Object or request between jsp??help??" Watch "how to transfer Object or request between jsp??help??" New topic
Author

how to transfer Object or request between jsp??help??

alex han
Ranch Hand

Joined: Dec 13, 2002
Posts: 46
i have two jsp---jsp1,jsp2.
in jsp1,hava some code that get a List object:


i want to transfer "test" to jsp2 by click a button,whose onclick function is:
and i can get "test" object in jsp2。but i don't want to use servlet/action to help transfer object, and i dont't want to use session ojbect to store List object...
Is there any method that can transfer object between jsp diectly???
i know the code

but i can't use javascript code to control those two java code..
help.......thanks a lot...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60741
    
  65

No. The only way to get from one JSP to the other is to perform a request to a server-side action, servlet, or the other JSP.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
danny liu
Ranch Hand

Joined: Jan 22, 2004
Posts: 185
use session object.
in jsp1:
session.setAttribute("data1",List1);

in jsp2:
List List1=(List)session.getAttribute("data1");
danny liu
Ranch Hand

Joined: Jan 22, 2004
Posts: 185
Or if you wanna put it into *request* scope.
you can do it this way:
<jsp:useBean id="data" class="java.util.List" scope="request" />
<%
populate data here
%>
<jsp:forward page="2.jsp" />
Hope it helps.
Dan
 
Consider Paul's rocket mass heater.
 
subject: how to transfer Object or request between jsp??help??
 
Similar Threads
jsp:include & jsp:param
Across JSPs wrong JavaScript Function with the same prototype is getting called
JSP Invoking another JSP in Iframe
Html:link forward +parameter passing
passing object from one jsp to another using session