You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sri Sankaran <Sr...@sas.com> on 2002/08/30 17:15:37 UTC

[]Testing for null value

Using Struts 1.0.2 on Tomcat 4.0.2

I see that the <logic:empty> is only available in Struts 1.1

How does one test for a null value using Struts 1.0 tags?

<logic:equal property="foo" value="<%=null%>">
   <%-- do something --%>
</logic:equal>

will not work since deep in the bowels of the <logic:equal> it does a value.length() and barfs on the null.

An ugly workaround is for the form bean to have an isNull() method for the property foo.

Sri

Re: [Taglib] Testing for null value using

Posted by Eddie Bush <ek...@swbell.net>.
You should look at <logic:present .../> and <logic:notPresent .../>

Sri Sankaran wrote:

>Using Struts 1.0.2 on Tomcat 4.0.2
>
>I see that the <logic:empty> is only available in Struts 1.1
>
>How does one test for a null value using Struts 1.0 tags?
>
><logic:equal property="foo" value="<%=null%>">
>   <%-- do something --%>
></logic:equal>
>
>will not work since deep in the bowels of the <logic:equal> it does a value.length() and barfs on the null.
>
>An ugly workaround is for the form bean to have an isNull() method for the property foo.
>
>Sri
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>