+ Start a Discussion
Big EarsBig Ears 

Visualforce Component Java Error - "...found MethodBindingMethodExpressionAdapter"

All,

I'm trying to pass an instance of a wrapper class into a Component and I'm getting the following error:
Wrong type for attribute <c:ea1_outcomeaction action="com.sun.faces.application.MethodBindingMethodExpressionAdapter@e94c054f">. Expected EA1_OutcomeAction, found MethodBindingMethodExpressionAdapter
The type "EA1_OutcomeAction" is a wrapper class with some attributes and a few methods. However, I've managed to comment almost all of the class out (and all of the contents of the component, with the exception of the attribute) and I'm still getting this error. It seems like a pretty deep Java error. Has anybody else seen this before?

Andy
 
Best Answer chosen by Big Ears
Big EarsBig Ears
The issue was simple - Attributes on Visualforce components shouldn't be named "action". It's a reserved keyword, but the compiler doesn't produce a nice error to let you know so it's not immediately obvious.

All Answers

Big EarsBig Ears
I can reproduce this with very basic code:

Page Code
<apex:page controller="EA1_DummyCode">
      <c:EA1_OutcomeAction action="{!act}"/>
</apex:page>
Page Controller
public with sharing class EA1_DummyCode {
	public EA1_OutcomeAction act{get; set;}
}
Component Markup
<apex:component >
	<apex:attribute name="action" type="EA1_OutcomeAction" Description="The instance of Apex Class OutcomeAction"/>
</apex:component
Wrapper class
public with sharing class EA1_OutcomeAction{
        //Completely commented everything out.
}
I'm not sure what the issue is at all!
 
karthikeyan perumalkarthikeyan perumal
Hello, 

Check the below post for same issue.  you may some thing missed in getter and setter.

http://salesforce.stackexchange.com/questions/102119/visualforce-component-getter-setters-from-a-base-class

hope this will help you, 

Thanks
karthik
 
Big EarsBig Ears
Karthik,

You may have misunderstood. The issue in the link you've provided isn't the same. My code won't compile due to a Java error, whereas the link you've provided relates to setting variables within a component.

Andy
Big EarsBig Ears
The issue was simple - Attributes on Visualforce components shouldn't be named "action". It's a reserved keyword, but the compiler doesn't produce a nice error to let you know so it's not immediately obvious.
This was selected as the best answer