tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy" <>
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 []
>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 <> wrote:
>> 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:
><jsp:useBean id="userSession" scope="session"
><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}

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message