webtier@glassfish.java.net

JSF 2 facelets custom tags with integer attributes

From: <webtier_at_javadesktop.org>
Date: Tue, 21 Jul 2009 06:47:37 PDT

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