This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Getting session attributes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Getting session attributes" Watch "Getting session attributes" New topic
Author

Getting session attributes

surendar prabu
Ranch Hand

Joined: Jul 24, 2006
Posts: 102
I need to use the attributes i have set in session in my JSP. i dont want to use scriplets to achieve this. is there any tags available to use session object and retrieve attributes from that? any tags in defined by struts or JSTL or some custom tags is fine.
please help me.

regards,
surendar prabu


SCJP 1.4
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Yes. For example, suppose you have a JavaBean named "user" as an attribute in the session, and you want to display the property "firstName" on that bean. Here's how you'd do it in Struts:

Here's how you'd do it in JSTL:

or just

This will check for a bean named "user" in any scope


Merrill
Consultant, Sima Solutions
surendar prabu
Ranch Hand

Joined: Jul 24, 2006
Posts: 102
Thanks Merill I got it.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Getting session attributes
 
Similar Threads
clarification reg jsp:invoke, variable directive etc..
session collusion problem
can we use 'session' in a method of jsp?
Example of Dynamic attribute in Custom Tag
User Behavior Tracing