[ 
https://issues.apache.org/jira/browse/MYFACES-2916?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12908893#action_12908893
 ] 

Mike Kienenberger commented on MYFACES-2916:
--------------------------------------------

Note that there a number of different ways to deal with this problem.

The easiest is to change your backing bean.

Other solutions are:

1) wrap your literal value in some kind of conversion function  (ie, a facelets 
function that converts a Number to an Integer)

2) Possibly you can manually specify a converter for the value to force it to 
be read/written as an integer -- not as sure about this one.

I'm pretty sure there are a number of other workarounds as well which have been 
documented in the past -- search the mailing list archives and the wiki to find 
them.


> "java.lang.NoSuchMethodException" error when call a managedbean int method
> --------------------------------------------------------------------------
>
>                 Key: MYFACES-2916
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2916
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 2.0.2-SNAPSHOT
>         Environment: OS:winxp
> JDK: 1.6.0_20
> Tomcat 7.0
>            Reporter: viola.lu
>            Priority: Minor
>         Attachments: el-exercises.war
>
>
> 1. Create a managed bean ,defind an int field
> package coreservlets;
> import javax.faces.bean.*;
> @ManagedBean
> public class SpanishColorMapper extends ColorMapper {
>     private int age;
>   public SpanishColorMapper() {
>     super("Spanish", "rojo", "anaranjado", "amarillo",
>           "verde", "negro", "blanco");
>   }
>   public int calYear(int x) {
>       return age + x;
>   }
>   public int getAge() {
>       return age;
>   }
>   public void setAge(int x) {
>       age = x;
>   }
> }
> 2.Direclty call calYear method in xhtml like:
> <td>#{spanishColorMapper.calYear(5)}</td>
> but  it's reported that :
> java.lang.NoSuchMethodException: 
> coreservlets.SpanishColorMapper.calYear(java.lang.Long)
> Caused by:
> java.lang.NoSuchMethodException - 
> coreservlets.SpanishColorMapper.calYear(java.lang.Long)
> Seems number is set as Long by default , not type as managedbean

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to