webtier@glassfish.java.net

Re: [webtier] JSF 2 facelets custom tags with integer attributes

From: Jan-Kees van Andel <jankeesvanandel_at_gmail.com>
Date: Tue, 21 Jul 2009 19:37:37 +0200

What type is the attribute? A String?

I don't know the specifics of the Mojarra implementation, but you
could try the type java.lang.Integer. That might make a difference...

Regards,
Jan-Kees

2009/7/21 <webtier_at_javadesktop.org>:
> I am trying to convert a spinner custom tag example from JSF 1/JSP to JSF 2/facelets. Here is my .taglib.facelets file:
>
> <facelet-taglib version="2.0" ...>
>   <namespace>http://corejsf.com</namespace>
>   <tag>
>      <tag-name>spinner</tag-name>
>      <component>
>         <component-type>com.corejsf.Spinner</component-type>
>      </component>
>      <attribute><name>minimum</name><type>int</type></attribute>
>      <attribute><name>maximum</name><type>int</type></attribute>
>   </tag>
> </facelet-taglib>
>
> When I use the tag
>
> <corejsf:spinner value="#{cardExpirationDate.month}"
>            id="monthSpinner" minimum="1" maximum="12" />
>
> the line
>
> Integer minimum = (Integer) getAttributes().get("minimum");
>
> throws a class cast exception. What gives? Does facelets not convert types like JSP does? Is the expected behavior documented anywhere? I couldn't find anything relevant in the JSF 2.0 spec.
>
> Thanks,
>
> Cay
> [Message sent by forum member 'cayhorstmann' (cayhorstmann)]
>
> http://forums.java.net/jive/thread.jspa?messageID=356759
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
>
>