You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "viola.lu (JIRA)" <de...@myfaces.apache.org> on 2010/09/13 12:07:34 UTC
[jira] Created: (MYFACES-2916) "java.lang.NoSuchMethodException"
error when call a managedbean int method
"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
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.
[jira] Commented: (MYFACES-2916) "java.lang.NoSuchMethodException"
error when call a managedbean int method
Posted by "Werner Punz (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/MYFACES-2916?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12908708#action_12908708 ]
Werner Punz commented on MYFACES-2916:
--------------------------------------
I personally think this is an issue of the underlying el implementation
> "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.
[jira] Commented: (MYFACES-2916) "java.lang.NoSuchMethodException"
error when call a managedbean int method
Posted by "viola.lu (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/MYFACES-2916?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12909085#action_12909085 ]
viola.lu commented on MYFACES-2916:
-----------------------------------
Thanks for your detailed explanation. i will check el implementation from my side. Thanks again.
> "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.
[jira] Commented: (MYFACES-2916) "java.lang.NoSuchMethodException"
error when call a managedbean int method
Posted by "Mike Kienenberger (JIRA)" <de...@myfaces.apache.org>.
[ 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.