|
-
November 6th, 2006, 11:51 PM
#1
Getting Session Attributes in a servlet.
Hi all,
Here we are using the properitory Framework, so Iam not sending Code Sinppet.
I have an application, where a servlet renders a Graph Image.
In that servlet, based on Price or Units of Goods, it builds Y-Axis. And it is coded to display "$" symbol on Y-Axis.
Requirement:
For Units on Y-Axis, do not append "$".
For Prices on Y-Axis, do append "$".
So what Iam doing is, Iam setting a flag in Session to know wheather Y-axis is Units or Prices, and trying to get the Session, and therefore Attribute.
Iam unable to do it. Is there any other way to do the above task?
Thanks and Regards.
-
November 7th, 2006, 12:52 AM
#2
Re: Getting Session Attributes in a servlet.
Hi,
To get the session:
Code:
// Will return the currreent session, if 1 doesn't exists will return null
request.getSession(false);
// OR
// Will return the currreent session, if 1 doesn't exists will create a new one
request.getSession(true);
Then to get the attribute:
Code:
request.getSession(false).getAttribute("MyAttributeName");
Hope This Helps
Byron Tymvios
Please use [ CODE ] and [/ CODE ] tags when posting code! See THIS on how to use code tags.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|