aspose file tools*
The moose likes Servlets and the fly likes how to use session attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "how to use session attribute" Watch "how to use session attribute" New topic
Author

how to use session attribute

Raghu ram
Ranch Hand

Joined: Oct 19, 2007
Posts: 34
Hello frnds,

I have customerlogin page (has username and password) and that linked to customerservice page and this one linked to change profile page(contains change password, change name, change phone no.) So using session attribute how to set that username so that in change profile page i want to get that username.
Reply soon
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60996
    
  65


[ January 11, 2008: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Raghu ram
Ranch Hand

Joined: Oct 19, 2007
Posts: 34
So How to send it to the browser
Raghu ram
Ranch Hand

Joined: Oct 19, 2007
Posts: 34
so that username has to get in the changeprofile browser.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41508
    
  53
What do you mean by "send it to the browser"? Session attributes exist (and are used) on the server.


Ping & DNS - my free Android networking tools app
Raghu ram
Ranch Hand

Joined: Oct 19, 2007
Posts: 34


from this code we will get username attribute. So to use this attribute in another servlet what should i do.
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3344

Originally posted by Raghu ram:


from this code we will get username attribute. So to use this attribute in another servlet what should i do.


Nothing much. Once you say, setAttribute, it sets the attribute in the particular session on the Server.

In any other servlet or jsp, you can get access to the session first and then from the session, you can get the attribute by making use of "getAttribute()".


Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
Raghu ram
Ranch Hand

Joined: Oct 19, 2007
Posts: 34
Thank you for the reply
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to use session attribute