users@glassfish.java.net

Possible bug in EL when checking for empty String

From: <forums_at_java.net>
Date: Tue, 5 Apr 2011 13:00:29 -0500 (CDT)

Hi,
I have a strange problem using EL in JSF 2 on GlassFish 3.1.  My output
depends on if a String property of a bean is empty or not.  Can anyone else
verify if this works for them?
The value of #{bean.stringProperty} is "my_image.gif"
#{empty bean.stringProperty}
result = true, should be false
#{bean.stringProperty == '' or bean.stringProperty == null}
result = true, should be false
#{bean.stringProperty == null or bean.stringProperty == ''}
result = true, should be false
#{bean.stringProperty == ''}
result = false, correct
#{bean.stringProperty == null}
result = true, should be false
It looks like I will need to move this logic into a new boolean property of
the bean.
Ryan

 


--
[Message sent by forum member 'rdelaplante']
View Post: http://forums.java.net/node/788997