Uhhh since when is the reference developer list deprecated? Note he
is talking about the Mojarra implementation not anything from JBoss.
I don't know exactly why it is not working, but having you
tried registering the converter manually on the h:inputText?
Manfred
> -------- Original Message --------
> Subject: Re: Is JSF incompatible with generics?
> From: Ilya Shaikovsky <ishaikovsky_at_exadel.com>
> Date: Tue, June 09, 2009 8:02 am
> To: dev_at_javaserverfaces.dev.java.net
>
>
> This list is deprecated. Use Jboss.org resources in order to get support.
>
> Regards!
>
> Freire, Jose Luis (PT - Lisbon) пишет:
> >
> > Using JSF 1.2.12, Facelets 1.1.14, Tomcat 6.0.18.
> >
> >
> >
> > I’m not sure where to open this bug, since I’m not sure if it’s JSF,
> > Facelets, or EL related.
> >
> >
> >
> > If we have this simple class:
> >
> > *public* *class* GenericsTestController<E *extends* Object> {
> >
> >
> >
> > *private* E value;
> >
> >
> >
> > *public* E getValue() {
> >
> > *return* value;
> >
> > }
> >
> >
> >
> > *public* *void* setValue(E value) {
> >
> > *this*.value = value;
> >
> > }
> >
> > }
> >
> >
> >
> > And we have this class to use as a managed bean (integerTest):
> >
> > *public* *class* IntegerTestController *extends*
> > GenericsTestController<Integer> {
> >
> >
> >
> > *public* String add() {
> >
> > setValue(getValue()+1);
> >
> > *return* *null*;
> >
> > }
> >
> > *public* String subtract() {
> >
> > setValue(getValue()-1);
> >
> > *return* *null*;
> >
> > }
> >
> > }
> >
> >
> >
> > This JSF code will not work:
> >
> > <h:form>
> >
> > Value:
> >
> > <h:inputText value="#{integerTest.value}" />
> >
> > <h:commandButton action="#{integerTest.add}" value="+" />
> >
> > <h:commandButton action="#{integerTest.subtract}" value="-" />
> >
> > </h:form>
> >
> >
> >
> > With this error:
> >
> > _java.lang.ClassCastException_: java.lang.String cannot be cast to
> > java.lang.Integer
> >
> > at
> > genericstest.IntegerTestController.add(_IntegerTestController.java:18_)
> >
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(_Native Method_)
> >
> > at
> > sun.reflect.NativeMethodAccessorImpl.invoke(_NativeMethodAccessorImpl.java:39_)
> >
> > at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(_DelegatingMethodAccessorImpl.java:25_)
> >
> > at java.lang.reflect.Method.invoke(_Method.java:597_)
> >
> > at org.apache.el.parser.AstValue.invoke(_AstValue.java:172_)
> >
> > at
> > org.apache.el.MethodExpressionImpl.invoke(_MethodExpressionImpl.java:276_)
> >
> > at
> > com.sun.facelets.el.TagMethodExpression.invoke(_TagMethodExpression.java:68_)
> >
> > at
> > javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(_MethodBindingMethodExpressionAdapter.java:88_)
> >
> > at
> > com.sun.faces.application.ActionListenerImpl.processAction(_ActionListenerImpl.java:102_)
> >
> > at javax.faces.component.UICommand.broadcast(_UICommand.java:387_)
> >
> > at
> > javax.faces.component.UIViewRoot.broadcastEvents(_UIViewRoot.java:475_)
> >
> > at
> > javax.faces.component.UIViewRoot.processApplication(_UIViewRoot.java:756_)
> >
> > at
> > com.sun.faces.lifecycle.InvokeApplicationPhase.execute(_InvokeApplicationPhase.java:82_)
> >
> > at com.sun.faces.lifecycle.Phase.doPhase(_Phase.java:100_)
> >
> > at
> > com.sun.faces.lifecycle.LifecycleImpl.execute(_LifecycleImpl.java:118_)
> >
> > at javax.faces.webapp.FacesServlet.service(_FacesServlet.java:265_)
> >
> > at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(_ApplicationFilterChain.java:290_)
> >
> > at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(_ApplicationFilterChain.java:206_)
> >
> > at
> > org.apache.catalina.core.StandardWrapperValve.invoke(_StandardWrapperValve.java:233_)
> >
> > at
> > org.apache.catalina.core.StandardContextValve.invoke(_StandardContextValve.java:191_)
> >
> > at
> > org.apache.catalina.core.StandardHostValve.invoke(_StandardHostValve.java:128_)
> >
> > at
> > org.apache.catalina.valves.ErrorReportValve.invoke(_ErrorReportValve.java:102_)
> >
> > at
> > org.apache.catalina.core.StandardEngineValve.invoke(_StandardEngineValve.java:109_)
> >
> > at
> > org.apache.catalina.connector.CoyoteAdapter.service(_CoyoteAdapter.java:286_)
> >
> > at
> > org.apache.coyote.http11.Http11Processor.process(_Http11Processor.java:845_)
> >
> > at
> > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(_Http11Protocol.java:583_)
> >
> > at
> > org.apache.tomcat.util.net.JIoEndpoint$Worker.run(_JIoEndpoint.java:447_)
> >
> > at java.lang.Thread.run(_Thread.java:619_)
> >
> >
> >
> > In fact, it fails with the same error even if we override getValue and
> > setValue on IntegerTestController.
> >
> >
> >
> > The only workaround is not to extend from GenericsTestController and
> > implement the “value” property as Integer in the IntegerTestController.
> >
> >
> >
> > Help anyone?**
> >
> > * *
> >
> > *José Freire
> > *Consulting - Financial Services Industry
> > Deloitte Consultores, S.A.
> > Deloitte | Edifício Atrium Saldanha, Praça Duque de Saldanha, 1 - 7º,
> > 1050-094 Lisboa, Portugal
> > Tel/Direct: +(351) 210 422 500 | Fax: +(351) 210 422 950
> > jfreire_at_deloitte.pt | www.deloitte.pt
> >
> > Please consider the environment before printing.
> >
> >
> >
> >
> >
> > *Disclaimer:*
> > Deloitte refers to one or more of Deloitte Touche Tohmatsu, a Swiss
> > Verein, its member firms, and their respective subsidiaries and
> > affiliates. As a Swiss Verein (association), neither Deloitte Touche
> > Tohmatsu nor any of its member firms has any liability for each
> > other's acts or omissions. Each of the member firms is a separate and
> > independent legal entity operating under the names "Deloitte,"
> > "Deloitte & Touche," "Deloitte Touche Tohmatsu," or other related
> > names. Services are provided by the member firms or their
> > subsidiaries or affiliates and not by the Deloitte Touche Tohmatsu Verein.
> > Privileged/Confidential Information may be contained in this message.
> > If you are not the addressee indicated in this message (or responsible
> > for delivery of the message to such person), you may not copy or
> > deliver this message to anyone. In such case, you should destroy this
> > message and kindly notify the sender by reply email. Please advise
> > immediately if you or your employer do not consent to Internet email
> > for messages of this kind. Opinions, conclusions and other information
> > in this message that do not relate to the official business of my firm
> > shall be understood as neither given nor endorsed by it.