tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rahul P Akolkar <akol...@us.ibm.com>
Subject RE: c:choose not evaluating correctly
Date Tue, 31 May 2005 13:48:26 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message