struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nadia Kunkov" <>
Subject JSTL when...test won't work.
Date Thu, 02 Dec 2004 15:24:55 GMT

This is my first try with JSTL and somewhere I'm getting the syntax wrong.  Could you please
help me?
I have a bean called user in the session.  One of this bean's properties is a hash map called
frmRoles.  I need to go over the hashmap's keys and test if a particular key exists.  I'm
not getting an error when I run the jsp,  it just tells me that this key is not found.  But
I can print all the keys so its my c:choose   test syntax.  The code that gives me a problem
is in bold face.  I also would like to ask you to point me to the documentation on the syntax
used within c:when test.  Is it regular expressions or JSTL syntax?

I'd appreciate any help.

Thanks in advance.


<%@ taglib prefix="c" uri="" %>
<%@ taglib prefix="c_rt" uri="" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<title>Welcome World!</title>
<body bgcolor="white">
<logic:present scope="session" name="user">
  <h3>Welcome <bean:write name="user"  property="userId"/>!</h3>
  <bean:write name="user" property="userFName"/>
  <bean:write name="user" property="userLName"/>
<logic:notPresent scope="session" name="user">
  <h3>Welcome World!</h3>
<li><html:link forward="logon">Sign in</html:link></li>
<logic:present scope="session" name="user">
  <li><html:link forward="logoff">Sign out</html:link></li>
  <bean:define id="fRoles"  name="user" property="frmRoles"/>
  <logic:iterate id="element" name="fRoles">
       Key is <bean:write name="element" property="key"/>  <br>
     Value is <bean:write name="element" property="value"/>  <br>
     <c:when test="${fRoles['manager'] != null}">
        Found formRoles manager
        NOT Found

<img src='struts-power.gif' alt='Powered by Struts'>


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

View raw message