You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Oded Arbel <od...@m-wise.com> on 2005/08/14 16:18:53 UTC

JSPx and EL - not really a taglib issue

Hi list.

I have a JSP file which uses <c:when> and <c:if> to compare numbers. for 
example, I have a case where a value may contain either null or the 
empty string - so I test like this:

<c:if test="${empty bean.value or fn:length(bean.value) < 1}">

This is because, contrary to "path of least surprise", empty treats 
empty strings as not-empty (well, they do contain a reference to a 
string object). 

My problem is that I'm now converting said page to JSPX (which is 
completely XML) and Tomcat correctly complains that "The value of 
attribute "test" associated with an element type "c:if" must not 
contain the '<' character.". 
I tried to put &lt; instead of < , which works but eclipse's WTP 
complains that it can't parse the instruction. I also think its ugly. 

Barring fixing "empty" to work correctly - is there a better way to 
check on string length, or generally to compare numbers, using EL in 
JSPX ?

-- 
Oded Arbel
m-Wise mobile solutions
oded@m-wise.com

+972-9-9611212 (204)
+972-54-7340014

::..
"It's bad enough being miserable, but it's even worse when everyone else 
claims to be miserable too."
	-- Eeyore

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


Re: JSPx and EL - not really a taglib issue

Posted by Oded Arbel <od...@m-wise.com>.
On Sunday, 14 בAugust 2005 18:26, Hassan Schroeder wrote:
> Oded Arbel wrote:
> > I have a JSP file which uses <c:when> and <c:if> to compare
> > numbers. for example, I have a case where a value may contain
> > either null or the empty string - so I test like this:
> >
> > <c:if test="${empty bean.value or fn:length(bean.value) < 1}">
> >
> > My problem is that I'm now converting said page to JSPX (which is
> > completely XML) and Tomcat correctly complains that "The value of
> > attribute "test" associated with an element type "c:if" must not
> > contain the '<' character.".
>
> <c:if test="${empty bean.value or fn:length(bean.value) lt 1}">
>
> (See section 3.4 -- Operators -- of the JSTL spec)

Cool! that works for me :-)

> HTH!

What's HTH ?

-- 
Oded Arbel
m-Wise mobile solutions
oded@m-wise.com

+972-9-9611212 (204)
+972-54-7340014

::..
Save the Earth - kill a lawyer 

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


Re: JSPx and EL - not really a taglib issue

Posted by Hassan Schroeder <ha...@webtuitive.com>.
Oded Arbel wrote:

> I have a JSP file which uses <c:when> and <c:if> to compare numbers. for 
> example, I have a case where a value may contain either null or the 
> empty string - so I test like this:
> 
> <c:if test="${empty bean.value or fn:length(bean.value) < 1}">

> My problem is that I'm now converting said page to JSPX (which is 
> completely XML) and Tomcat correctly complains that "The value of 
> attribute "test" associated with an element type "c:if" must not 
> contain the '<' character.". 

<c:if test="${empty bean.value or fn:length(bean.value) lt 1}">

(See section 3.4 -- Operators -- of the JSTL spec)

HTH!
-- 
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.



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