No subject
Thu Mar 18 00:20:18 PST 2004
Setting the session attribute:
<!--the session object is implicit, so you don't need to create
it-->
<%
session.setAttribute("arbitary_attribute_name",yourObjectInstance);
%>
Retrieving your object from the session:
<%
YourObject yourObjectInstance =
(YourObject)session.getAttribute("arbitary_attribute_name");
%>
You can mix and match, i.e. you could set the session attribute from within
a servlet and be able to access it from a jsp.
If you are using the <jsp:useBean tag>, make sure the scope is set to
"session". By default, <jsp:useBean> defaults to (I think) "page" as its
scope.
p.s.
Make sure that session management is on for your servlet container. Take a
look at your web.xml for your specific web application and the add following
entry to be safe:
<session-config>
<session-timeout>30</session-timeout>
</session-config>
This tells the container that this specific web application will hold
session information for up to 30 minutes of user inactivity.
Regards,
Scott
-----Original Message-----
From: gurudev vijayanand [mailto:gvijayanand at yahoo.com]
Sent: Tuesday, August 14, 2001 10:12 AM
To: OPENSOURCE at jcorporate.com
Subject: [Opensource] HOW TO MAINTAIN THE STATE OF AN OF AN OBJECT IN
JSP
hi,
i am designing a web page in which i have to maintain
the state of many objects and get them when required.
i am facing problem in maitaining the session of an
object,each time i refresh the page the state is lost.
and i am compelled to duplicate session objects each
time i refresh and this is causing too much of
problem.
In minimising and maximising the frame the state of an
object is lost,can anyone please help me out in this
regard,
thanks,
vijayanand.g
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
_______________________________________________
Opensource mailing list
Opensource at javacorporate.com
http://www.javacorporate.com/mailman/listinfo/opensource
More information about the Opensource
mailing list