Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java Open Source > Struts
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Struts section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 9th, 2008, 08:11 PM
Registered User
 
Join Date: Mar 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to AndeeeUk
Default Problem with sessions

I have a web app which has a login page, in its action class I create an object, student, and save it into session by using

session = request.getSession(true);
session.setAttribute("Student", student)

can i then return the student session using:

session.getAttribute("Student");

Then call this from many action classes?

Thanks
Andy

 
Old March 24th, 2008, 08:11 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Once you set an object into session. you can read it using getAttribute() method of HttpSession class through out the user session. It'll only expire with the session object.

- Rakesh
 
Old July 15th, 2008, 12:35 AM
Registered User
 
Join Date: Jul 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

In other actions classes use code like
HttpSession session=request.getSession(false);
session.getAttribute("Student")

if you use "false' means you are creating new session instance.
so that vat ever value you setted will be retrived.

you will get the value and u can use in the action classes



skumar





Similar Threads
Thread Thread Starter Forum Replies Last Post
help me in sessions bonnythalli SQL Server 2000 1 September 20th, 2006 08:06 AM
Problem passing through sessions dmlocke PHP Databases 4 June 26th, 2006 08:08 PM
Sessions come and go Surre ASP.NET 1.0 and 1.1 Professional 2 April 10th, 2006 05:55 AM
Sessions 2540EA BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 February 20th, 2005 05:42 AM
Mixing classic ASP sessions with ASP.NET sessions scorpion_king General .NET 2 August 4th, 2004 08:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.