You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Le Nguyen-Thinh <nt...@nats.informatik.uni-hamburg.de> on 2006/08/08 13:00:40 UTC

Taglibs ; error in a JSP using expression langluage

Dear friends,

I have a JSP which uses following taglibs:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>


My JSP contains a piece of code which calls a tag from the taglib above:
<c:forEach begin="${0}" end="${MAX-1}" step="${1}" var="ind">					
					<c:set target="${argBean}" property="name" value="${paramValues.argName[ind]}" />
					<c:set target="${argBean}" property="type" value="${paramValues.argType[ind]}" />
					<c:set target="${argBean}" property="mode" value="${paramValues.argMode[ind]}" />
					<c:set target="${argBean}" property="state" value="${paramValues.argState[ind]}" />
					<c:set target="${predBean}" property="predArg" value="${argBean}" />
</c:forEach>	

The Tomcat server returns following error:

java.lang.NumberFormatException: For input string: "${0}"
	java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
	java.lang.Integer.parseInt(Integer.java:447)
	java.lang.Integer.valueOf(Integer.java:553)
	org.apache.jasper.compiler.JspUtil.coerceToInt(JspUtil.java:752)

It seems to me that Tomcat could not interpret the JSP. 
My question is, do I miss some libraries? Do 
My application runs on Linux Debian, Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05) (j2sdk1.5-sun).
The taglibs jstl.jar and standard.jar stem from jakarta-taglibs-standard-1.1.2.

Thanks a lot for your help.

Thinh


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Taglibs ; error in a JSP using expression langluage

Posted by Hassan Schroeder <ha...@gmail.com>.
On 8/8/06, Le Nguyen-Thinh <nt...@nats.informatik.uni-hamburg.de> wrote:

> My JSP contains a piece of code which calls a tag from the taglib above:
> <c:forEach begin="${0}" end="${MAX-1}" step="${1}" var="ind">

What in the world is that supposed  to be referring to?

> java.lang.NumberFormatException: For input string: "${0}"

Try:  <c:forEach begin="0" end="${MAX-1}" step="1" var="ind">

(assuming MAX is actually set somewhere to an integer value...)

-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Taglibs ; error in a JSP using expression langluage

Posted by Le Nguyen-Thinh <nt...@nats.informatik.uni-hamburg.de>.
Thanks all for your advice.
My web.xml has an entry:

!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">

which, I think, caused the error.

I have inserted the line:

<%@ page ... isELIgnored="false" %>

as Pid suggested and the error disappeared.

Thanks a lot.

Thinh


David Smith wrote:

> One other possibility -- which servlet spec version do you have 
> specified in your web.xml?  If web.xml declares an older version of 
> the servlet spec, these ${} expressions may not be available.
>
> --David
>
> Pid wrote:
>
>> which version of tomcat are you using?
>>
>> is Expression Language enabled? as it looks like it's passing the ${0}
>> variable as a string rather than evaluating it.
>>
>> Try setting the following attribute in your JSP 'page' directive.
>>
>> <%@ page ... isELIgnored="false" %>
>>
>>
>> Le Nguyen-Thinh wrote:
>>  
>>
>>> Dear friends,
>>>
>>> I have a JSP which uses following taglibs:
>>>
>>> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
>>> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
>>>
>>>
>>> My JSP contains a piece of code which calls a tag from the taglib 
>>> above:
>>> <c:forEach begin="${0}" end="${MAX-1}" step="${1}"
>>> var="ind">                                      <c:set 
>>> target="${argBean}" property="name"
>>> value="${paramValues.argName[ind]}" />
>>>                    <c:set target="${argBean}" property="type"
>>> value="${paramValues.argType[ind]}" />
>>>                    <c:set target="${argBean}" property="mode"
>>> value="${paramValues.argMode[ind]}" />
>>>                    <c:set target="${argBean}" property="state"
>>> value="${paramValues.argState[ind]}" />
>>>                    <c:set target="${predBean}" property="predArg"
>>> value="${argBean}" />
>>> </c:forEach>  
>>> The Tomcat server returns following error:
>>>
>>> java.lang.NumberFormatException: For input string: "${0}"
>>>    
>>> java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) 
>>>
>>>
>>>    java.lang.Integer.parseInt(Integer.java:447)
>>>    java.lang.Integer.valueOf(Integer.java:553)
>>>    org.apache.jasper.compiler.JspUtil.coerceToInt(JspUtil.java:752)
>>>
>>> It seems to me that Tomcat could not interpret the JSP. My question is,
>>> do I miss some libraries? Do My application runs on Linux Debian,
>>> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
>>> (j2sdk1.5-sun).
>>> The taglibs jstl.jar and standard.jar stem from
>>> jakarta-taglibs-standard-1.1.2.
>>>
>>> Thanks a lot for your help.
>>>
>>> Thinh
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To start a new topic, e-mail: users@tomcat.apache.org
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>>
>>>   
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>  
>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Taglibs ; error in a JSP using expression langluage

Posted by David Smith <dn...@cornell.edu>.
One other possibility -- which servlet spec version do you have 
specified in your web.xml?  If web.xml declares an older version of the 
servlet spec, these ${} expressions may not be available.

--David

Pid wrote:

>which version of tomcat are you using?
>
>is Expression Language enabled? as it looks like it's passing the ${0}
>variable as a string rather than evaluating it.
>
>Try setting the following attribute in your JSP 'page' directive.
>
><%@ page ... isELIgnored="false" %>
>
>
>Le Nguyen-Thinh wrote:
>  
>
>>Dear friends,
>>
>>I have a JSP which uses following taglibs:
>>
>><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
>><%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
>>
>>
>>My JSP contains a piece of code which calls a tag from the taglib above:
>><c:forEach begin="${0}" end="${MAX-1}" step="${1}"
>>var="ind">                   
>>                    <c:set target="${argBean}" property="name"
>>value="${paramValues.argName[ind]}" />
>>                    <c:set target="${argBean}" property="type"
>>value="${paramValues.argType[ind]}" />
>>                    <c:set target="${argBean}" property="mode"
>>value="${paramValues.argMode[ind]}" />
>>                    <c:set target="${argBean}" property="state"
>>value="${paramValues.argState[ind]}" />
>>                    <c:set target="${predBean}" property="predArg"
>>value="${argBean}" />
>></c:forEach>   
>>
>>The Tomcat server returns following error:
>>
>>java.lang.NumberFormatException: For input string: "${0}"
>>    java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
>>
>>    java.lang.Integer.parseInt(Integer.java:447)
>>    java.lang.Integer.valueOf(Integer.java:553)
>>    org.apache.jasper.compiler.JspUtil.coerceToInt(JspUtil.java:752)
>>
>>It seems to me that Tomcat could not interpret the JSP. My question is,
>>do I miss some libraries? Do My application runs on Linux Debian,
>>Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
>>(j2sdk1.5-sun).
>>The taglibs jstl.jar and standard.jar stem from
>>jakarta-taglibs-standard-1.1.2.
>>
>>Thanks a lot for your help.
>>
>>Thinh
>>
>>
>>---------------------------------------------------------------------
>>To start a new topic, e-mail: users@tomcat.apache.org
>>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
>>    
>>
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>  
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Taglibs ; error in a JSP using expression langluage

Posted by Pid <p...@pidster.com>.
which version of tomcat are you using?

is Expression Language enabled? as it looks like it's passing the ${0}
variable as a string rather than evaluating it.

Try setting the following attribute in your JSP 'page' directive.

<%@ page ... isELIgnored="false" %>


Le Nguyen-Thinh wrote:
> Dear friends,
> 
> I have a JSP which uses following taglibs:
> 
> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
> 
> 
> My JSP contains a piece of code which calls a tag from the taglib above:
> <c:forEach begin="${0}" end="${MAX-1}" step="${1}"
> var="ind">                   
>                     <c:set target="${argBean}" property="name"
> value="${paramValues.argName[ind]}" />
>                     <c:set target="${argBean}" property="type"
> value="${paramValues.argType[ind]}" />
>                     <c:set target="${argBean}" property="mode"
> value="${paramValues.argMode[ind]}" />
>                     <c:set target="${argBean}" property="state"
> value="${paramValues.argState[ind]}" />
>                     <c:set target="${predBean}" property="predArg"
> value="${argBean}" />
> </c:forEach>   
> 
> The Tomcat server returns following error:
> 
> java.lang.NumberFormatException: For input string: "${0}"
>     java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
> 
>     java.lang.Integer.parseInt(Integer.java:447)
>     java.lang.Integer.valueOf(Integer.java:553)
>     org.apache.jasper.compiler.JspUtil.coerceToInt(JspUtil.java:752)
> 
> It seems to me that Tomcat could not interpret the JSP. My question is,
> do I miss some libraries? Do My application runs on Linux Debian,
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
> (j2sdk1.5-sun).
> The taglibs jstl.jar and standard.jar stem from
> jakarta-taglibs-standard-1.1.2.
> 
> Thanks a lot for your help.
> 
> Thinh
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org