You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by le...@bankone.com on 2003/07/24 22:36:46 UTC

Problem: logic:notEqual does not work with null values

Hi!

I need to check if the certain String field in the bean is not null, then
I display certain elements in my JSP (running it on Websphere 4.0):

So, I do this check:
  <logic:notEqual name="accountForm" property="postalCode" value="null">
        do something
  </logic:notEqual>

That does not work. The server gives me error, something like: "Null
attribute value"

or when I check for empty strings, I tried this:

  <logic:notEqual name="accountForm" property="postalCode"
value="<%=""%>">
        do something
  </logic:notEqual>

Get server error: "Attribute  has no value"

Then I tried this:

  <logic:notEqual name="accountForm" property="postalCode" value="
<%=null%>">
        do something
  </logic:notEqual>


Does not work either. How can I make it work? How can I do this check
correctly? Are there any workarounds?

Thanks.




This transmission may contain information that is privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Problem: logic:notEqual does not work with null values

Posted by Alex Shneyderman <al...@law.columbia.edu>.
I think, you should use notEmpty to check for null

> -----Original Message-----
> From: leonard_reinstein@bankone.com
[mailto:leonard_reinstein@bankone.com]
> Sent: Thursday, July 24, 2003 4:37 PM
> To: struts-user@jakarta.apache.org
> Subject: Problem: logic:notEqual does not work with null values
> 
> 
> Hi!
> 
> I need to check if the certain String field in the bean is not null,
then
> I display certain elements in my JSP (running it on Websphere 4.0):
> 
> So, I do this check:
>   <logic:notEqual name="accountForm" property="postalCode"
value="null">
>         do something
>   </logic:notEqual>
> 
> That does not work. The server gives me error, something like: "Null
> attribute value"
> 
> or when I check for empty strings, I tried this:
> 
>   <logic:notEqual name="accountForm" property="postalCode"
> value="<%=""%>">
>         do something
>   </logic:notEqual>
> 
> Get server error: "Attribute  has no value"
> 
> Then I tried this:
> 
>   <logic:notEqual name="accountForm" property="postalCode" value="
> <%=null%>">
>         do something
>   </logic:notEqual>
> 
> 
> Does not work either. How can I make it work? How can I do this check
> correctly? Are there any workarounds?
> 
> Thanks.
> 
> 
> 
> 
> This transmission may contain information that is privileged,
confidential
> and/or exempt from disclosure under applicable law. If you are not the
> intended recipient, you are hereby notified that any disclosure,
copying,
> distribution, or use of the information contained herein (including
any
> reliance thereon) is STRICTLY PROHIBITED. If you received this
> transmission in error, please immediately contact the sender and
destroy
> the material in its entirety, whether in electronic or hard copy
format.
> Thank you.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org