Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java Open Source > Struts
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 9th, 2008, 08:11 PM
Registered User
 
Join Date: Mar 2008
Location: , , .
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

Reply With Quote
  #2 (permalink)  
Old March 24th, 2008, 08:11 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
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
Reply With Quote
  #3 (permalink)  
Old July 15th, 2008, 12:35 AM
Registered User
 
Join Date: Jul 2008
Location: , , .
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 08:34 AM.


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