Hristo,

I would try use intValue() which is a method of java.lang.Long (right out of
the J2SE docs... I think this is more of a general Java question than
Jelly/Jexl.). So try:

end="${currentKey.count.intValue()-1}"

Hope this works.

Otto


----- Original Message -----
From: "Hristo Stoyanov" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 30, 2002 8:04 PM
Subject: [jelly][Jexl] Integer type coersion issues


> Hi all-,
> I have the following piece of Jelly script:
> ------------------------------------
> <j:forEach
>    var="childKeyIndex"
>    begin="0"
>    end="${currentKey.count-1}">
> ....
> </j:forEach>
> ------------------------------------
>
> The problem is that even though 'currentKey.count'
> is "int", I actually get "java.lang.Long" for
> the 'end' loop attribute and Jelly complains:
> ----------------------------------------------
> WARNING: Cannot call method: setEnd as I cannot
> convert: -1 of type: java.lang.L
> ong into type: int
> Exception in thread "main"
> org.apache.commons.jelly.JellyException: Cannot call
> method: setEnd on tag of type:
> org.apache.commons.jelly.tags.core.ForEachTag wit
> h value: -1 of type: java.lang.Long. Exception:
> java.lang.IllegalArgumentExcepti
> on: argument type mismatch File:
> jar:file:/C:/imark/objecttree/dist/imexp30.jar!
> /imexp30.xml At tag <j:forEach>: line: 153 column: 79
>         at
> org.apache.commons.jelly.impl.TagScript.createJellyException(TagScrip
> t.java:475)
>         at
> org.apache.commons.jelly.impl.BeanTagScript.run(BeanTagScript.java:17
> 1)
>         at
> org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:134)
>         at
> org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:190)
>         at
> org.apache.commons.jelly.impl.StaticTag.doTag(StaticTag.java:111)
>         at
> org.apache.commons.jelly.impl.StaticTagScript.run(StaticTagScript.jav
> a:137)
> ----------------------------------------------
>
>
> Is this explained int he docs and where?
>
> Thanks
> Hristo
>
> __________________________________________________
> Do you Yahoo!?
> New DSL Internet Access from SBC & Yahoo!
> http://sbc.yahoo.com
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to