[prev in list] [next in list] [prev in thread] [next in thread] 

List:       taglibs-user
Subject:    RE: c:choose not evaluating correctly
From:       "Andy" <andy () fritter ! net>
Date:       2005-05-31 16:23:35
Message-ID: IOEJJNIDKDLHGOLGHPDNKEBLCEAA.andy () fritter ! net
[Download RAW message or body]


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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic