You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Joe Barefoot <Jo...@motiva.com> on 2002/09/23 22:16:55 UTC

RE: logic:present on session bean

You have to specify the name that you used in your <form-bean> declaration in your struts-config.  This is the name Struts will use as the session attribute's key.  It looks like you may be using the class name instead.

peace,
Joe


> -----Original Message-----
> From: Vinh Tran [mailto:vinht@processintelligence.com]
> Sent: Monday, September 23, 2002 1:18 PM
> To: struts-user@jakarta.apache.org
> Subject: logic:present on session bean
> 
> 
> All:
> 
> I have a custom bean that is placed in a user session.  How 
> can I detect if
> the bean exist in the session?  I have tried the following 
> but it does not
> work.  Is there a better method for accomplishing this?  Thanks.
> 
> 
> <logic:notPresent name="org.apache.struts.MyCustomBean">
>     do something.....
> </logic:notPresent>
> 
> <logic:present name="org.apache.struts.MyCustomBean">
>     do something else...
> </logic:present>
> 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: logic:present on session bean

Posted by Vinh Tran <vi...@processintelligence.com>.
Joe:

I don't know if this matters but this is not a form bean. It is merely a
custom bean that holds user information and is placed in a session once a
user logs in to the application. I tried your suggestion but it did not
work.

Here is what I tried:

<form-bean name="myBean" type="org.apache.struts.MyBean"/>

in JSP:

<logic:present name="myBean">
	do something...
</logic:present>

I guess my question is now two-fold...
1. Is it possible to use the logic:present tag to check if the session
contains a particular bean?
2. What is the best practice approach for doing this?

Thanks

-----Original Message-----
From: Joe Barefoot [mailto:Joe.Barefoot@motiva.com]
Sent: Monday, September 23, 2002 4:17 PM
To: Struts Users Mailing List; vinht@processintelligence.com
Subject: RE: logic:present on session bean


You have to specify the name that you used in your <form-bean> declaration
in your struts-config.  This is the name Struts will use as the session
attribute's key.  It looks like you may be using the class name instead.

peace,
Joe


> -----Original Message-----
> From: Vinh Tran [mailto:vinht@processintelligence.com]
> Sent: Monday, September 23, 2002 1:18 PM
> To: struts-user@jakarta.apache.org
> Subject: logic:present on session bean
>
>
> All:
>
> I have a custom bean that is placed in a user session.  How
> can I detect if
> the bean exist in the session?  I have tried the following
> but it does not
> work.  Is there a better method for accomplishing this?  Thanks.
>
>
> <logic:notPresent name="org.apache.struts.MyCustomBean">
>     do something.....
> </logic:notPresent>
>
> <logic:present name="org.apache.struts.MyCustomBean">
>     do something else...
> </logic:present>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>