On Thu, 2 May 2002, Matt Raible wrote:

> I am trying to do the following:
> 
> <c:when test="${topicForm.image == ''}">
> 
> but it doesn't seem to work even when getImage() returns "".

This works in the general case.  Consider the following example:

 <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"; %>
 <%!
   public static class FooBean {
     public String getValue() { return ""; }
   }
 %>
 <% pageContext.setAttribute("foo", new FooBean()); %>

 <c:if test="${foo.value == ''}">
   foo.value returned an empty string
 </c:if>

Are you sure your topicForm.image property really equals ""?

> I tried the keyword "empty" as well with no luck:
> 
> <c:when test="${topicForm.image == empty}">

The syntax is 'empty foo', not 'foo == empty'.  As in:

  <c:if test="${empty foo.value}">
    foo.value is null, the empty string, or an empty collection
  </c:if>

-- 
Shawn Bayern
"JSP Standard Tag Library"   http://www.jstlbook.com
(coming this summer from Manning Publications)


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to