• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use session object.
in jsp1:
session.setAttribute("data1",List1);

in jsp2:
List List1=(List)session.getAttribute("data1");
 
danny liu
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic