tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy" <a...@fritter.net>
Subject RE: c:choose not evaluating correctly
Date Tue, 31 May 2005 16:23:35 GMT

Ahh I now I understand, useBean is redundant with EL, when you're not
interested in instantiating beans.

Your example worked perfectly. Thanks.

>-----Original Message-----
>From: Rahul P Akolkar [mailto:akolkar@us.ibm.com]
>Sent: 31 May 2005 14:48
>To: Tag Libraries Users List
>Subject: RE: c:choose not evaluating correctly
>
>
>A jsp:useBean declaration, that changes things ;-)
>
>On 5/31/05, Andy <andy@fritter.net> wrote:
><snip/>
>> I can see lots of horrible conditional glue logic in my future.
>
>No, really, atleast not because of whats discussed in this thread.
>
>I would:
>1) Set the session attribute in the Struts layer only if the
>username/password were valid (thats what you're doing)
>2) Not have a jsp:useBean declaration in the JSP (so if the
>username/password is not valid, a bean isn't instantiated)
>3) Use the empty operator in EL expressions (on the 'userSession' bean
>itself, not any property)
>4) Change this bit:
>
>Username:
><jsp:useBean id="userSession" scope="session"
>class="template.filter.UserSession"/>
><jsp:getProperty name="userSession" property="username"></jsp:getProperty>
>
>(I suspect the userSession constructor initializes username to a non-null
>value? Otherwise, you'd see a NPE here?)
>
>to this:
>
><c:if test="${not empty sessionScope.userSession}">
>  Username: ${sessionScope.userSession.username}
></c:if>
>
>-Rahul
>



---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Mime
View raw message