>I have an object (ContactModel). One of its methods is named
>"isEmailAddressNull" and returns a boolean. I'm trying to query that
[quoted text clipped - 13 lines]
>
>then the link *never* appears, regardless of the value returned.

Signature
Tim Slattery
Slattery_T@bls.gov
http://members.cox.net/slatteryt
>> I have an object (ContactModel). One of its methods is named
>> "isEmailAddressNull" and returns a boolean. I'm trying to query that
[quoted text clipped - 26 lines]
>
> It works fine. I don't get it.
I don't either, assuming the boolean test worked the same both times and that
the parentheses didn't matter. Have you tested with equivalent constants?
<c:if test="${! true }" >
There's another syntax that, assuming there is an attribute 'emailAddress' in
ContactBean, avoids duplicating information in the bean (maintaining both the
address and the flag copying the state) and eliminates the redundant boolean
is...() method:
<c:if test="${! empty ContactBean.emailAddress}" >
which has the virtue of handling the value being null or empty.

Signature
Lew
Lew - 25 May 2007 15:48 GMT
> There's another syntax that, assuming there is an attribute
> 'emailAddress' in ContactBean, avoids duplicating information in the
[quoted text clipped - 4 lines]
>
> which has the virtue of handling the value being null or empty.
I tried the following and found negation worked just fine:
<sscce exceptfor="not showing the rest of the Web app infrastructure such as
web.xml" >
checkit.jsp
-----------
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<h1>Negation Test</h1>
<jsp:useBean id="eg" class="testit.Example" />
<jsp:setProperty name="eg" property="name" value="Jo" />
<c:if test="${ eg.non }">
<h2>Yes non</h2>
</c:if>
<c:if test="${ ! eg.non }">
<h2>Not non</h2>
</c:if>
<c:if test="${ ! (eg.non) }">
<h2>Not (non)</h2>
</c:if>
<c:if test="${ ! empty eg.name }">
<h2>Not empty name</h2>
</c:if>
</body>
</html>
-----------
testit/Example.java
-----------
package testit;
public class Example
{
private String name;
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public boolean isNon()
{
return name == null;
}
}
-----------
</sscce>

Signature
Lew