aspose file tools*
The moose likes Struts and the fly likes checking for bean in session Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "checking for bean in session" Watch "checking for bean in session" New topic
Author

checking for bean in session

pendse anagha
Ranch Hand

Joined: Mar 09, 2005
Posts: 44
Hello ,
I have a login Screen - and after Login I am storing a plain JavaBean on session .

In all the JSP pages - I want to show the name of the user logged in ( from the Java Bean on session )

For this I am using a common JSP
This is also used on the Login Screen

I want to first check - if the simple Java bean is on session

However - neither logic resent nor logic:empty seems to work

Any help would be greatly appreciated
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

logic resent should work. If you don't post what you are trying, no one can tell you what you are doing wrong.


A good workman is known by his tools.
pendse anagha
Ranch Hand

Joined: Mar 09, 2005
Posts: 44
yes - I guess with out the code - its going to be difficult

Here is what I am trying :


Though the first time there is no bean on session - I enter the condition of Not null and I get the print :
" I SHOULD NOT BE HERE SINCE NO BEAN IS ON SESSION "

Thanks ,
-anagha
Horatio Westock
Ranch Hand

Joined: Feb 23, 2005
Posts: 221
Remember that the notPresent tag needs the same attributes as the present one - it doesn't get them by magic.
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

If you don't like specifying a test each time, look at JSTL's core library. c:choose allows something similar to if/else with when/otherwise:


[ March 11, 2005: Message edited by: Marc Peabody ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: checking for bean in session