You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org> on 2007/11/18 01:42:43 UTC
[jira] Commented: (MYFACES-1695) f:setPropertyActionListener and
h:commandButton leads to IllegalArgumentException
[ https://issues.apache.org/jira/browse/MYFACES-1695?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12543324 ]
Leonardo Uribe commented on MYFACES-1695:
-----------------------------------------
Working on f:setPropertyActionListener in comparison with jsf 1.2_05 RI without facelets on Tomcat 6.0.14 myfaces throws
IllegalArgumentException when try to do this:
<h:commandButton value="set to 1">
<f:setPropertyActionListener target="#{setPropertyBean.intValue}" value="#{1}"/>
</h:commandButton>
or this
<h:commandButton value="set to 1">
<f:setPropertyActionListener target="#{setPropertyBean.intValue}" value="1"/>
</h:commandButton>
or this trying to set a bigInteger
<h:commandButton value="set to 1">
<f:setPropertyActionListener target="#{setPropertyBean.bigIntegerValue}" value="#{1}"/>
</h:commandButton>
JSF RI also do not assign the property, but do not throws an exception, which is bad.
I believe that actual Myfaces behaviour is preferred over JSF RI.
> f:setPropertyActionListener and h:commandButton leads to IllegalArgumentException
> ----------------------------------------------------------------------------------
>
> Key: MYFACES-1695
> URL: https://issues.apache.org/jira/browse/MYFACES-1695
> Project: MyFaces Core
> Issue Type: Bug
> Affects Versions: 1.2.1-SNAPSHOT
> Environment: Tomcat 6.0.13, Facelet 1.1.12 / Facelet 1.1.13 snapshot, MyFaces 1.2.1snapshot
> Reporter: Jan Ziegler
>
> Im having a problem with f:setPropertyActionListener when binding the target to an int-field. I never had this problem when using the latest MyFaces 1.1 and Facelets 1.1.12 which backported the setPropertyActionListener-functionality to JSF 1.1 Environments.
> Here´s an excerpt of the example xhtml-page:
> <h:commandButton value="click">
> <f:setPropertyActionListener target="#{myBean.currentPage}" value="1" />
> </h:commandButton>
> and here the bean (int-approach):
> public class MyBean
> {
> private int currentPage;
> ...
> public int getCurrentPage()
> {
> return this.currentPage;
> }
> public int setCurrentPage(int page)
> {
> this.currentPage = page;
> }
> ...
> }
> So when I click on the button to perform a submit I´m getting the following Exception:
> java.lang.IllegalArgumentException: argument type mismatch
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at javax.el.BeanELResolver.setValue(BeanELResolver.java:108)
> at javax.el.CompositeELResolver.setValue(CompositeELResolver.java:68)
> at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.access$501(FacesCompositeELResolver.java:46)
> at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver$6.invoke(FacesCompositeELResolver.java:132)
> at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.invoke(FacesCompositeELResolver.java:148)
> at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.setValue(FacesCompositeELResolver.java:128)
> at org.apache.el.parser.AstValue.setValue(AstValue.java:114)
> at org.apache.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:249)
> at com.sun.facelets.el.TagValueExpression.setValue(TagValueExpression.java:93)
> at com.sun.facelets.tag.jsf.core.SetPropertyActionListenerHandler$SetPropertyListener.processAction(SetPropertyActionListenerHandler.java:113)
> at javax.faces.event.ActionEvent.processListener(ActionEvent.java:48)
> at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:487)
> at javax.faces.component.UICommand.broadcast(UICommand.java:105)
> at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:292)
> at javax.faces.component.UIViewRoot.process(UIViewRoot.java:209)
> at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:117)
> at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
> at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
> at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
> at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
> at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
> at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
> at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> at java.lang.Thread.run(Unknown Source)
> Afterwards I changed the target-binding to String -this fixed the problem for my xhtml-example above. I change the Methods like this:
> public class MyBean
> {
> private int currentPage;
> ...
> public String getCurrentPage()
> {
> return String.valueOf(this.currentPage);
> }
> public void setCurrentPage(String page)
> {
> this.currentPage = Integer.parseInt(page);
> }
> ...
> }
> so far so good, but I´m facing another problem, when having "calculated-expression" as the value of setPropertyActionListener like:
> <f:setPropertyActionListener target="#{myBean.currentPage}" value="#{myBean.currentPage - 1}" />
> then neither the int-approach nor the string-approach works. with using the int-binding I´m getting the same error as above and with the string-binding i get another IllegalArgumentException (caused by a ClassCastException):
> java.lang.IllegalArgumentException: java.lang.ClassCastException@9945e9
> at sun.reflect.GeneratedMethodAccessor188.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at javax.el.BeanELResolver.setValue(BeanELResolver.java:108)
> at javax.el.CompositeELResolver.setValue(CompositeELResolver.java:68)
> at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.access$501(FacesCompositeELResolver.java:46)
> at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver$6.invoke(FacesCompositeELResolver.java:132)
> at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.invoke(FacesCompositeELResolver.java:148)
> at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.setValue(FacesCompositeELResolver.java:128)
> at org.apache.el.parser.AstValue.setValue(AstValue.java:114)
> at org.apache.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:249)
> at com.sun.facelets.el.TagValueExpression.setValue(TagValueExpression.java:93)
> at com.sun.facelets.tag.jsf.core.SetPropertyActionListenerHandler$SetPropertyListener.processAction(SetPropertyActionListenerHandler.java:113)
> at javax.faces.event.ActionEvent.processListener(ActionEvent.java:48)
> at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:487)
> at javax.faces.component.UICommand.broadcast(UICommand.java:105)
> at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:292)
> at javax.faces.component.UIViewRoot.process(UIViewRoot.java:209)
> at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:117)
> at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
> at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
> at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
> at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
> at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
> at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
> at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> at java.lang.Thread.run(Unknown Source)
> I also tried to use standard converters to ensure that "value" is always converted to an Integer or String, e.g.:
> <f:setPropertyActionListener target="#{myBean.currentPage}" value="1" >
> <f:convertNumber integerOnly="true"/>
> </f:setPropertyActionListener>
> But I also had no luck with this. It didn´t change anything.
> So whats wrong here? Do I have to ensure or convert the value somehow or should the jsf-implementation perform the needed convertions?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.