1

All,

I've created a Visualforce component which takes an instance of an Apex wrapper class as an attribute. However, when I attempt to insert the component into a VF page, I get the following error when trying to save:

Wrong type for attribute <c:ea1_outcomeaction action="com.sun.faces.application.MethodBindingMethodExpressionAdapter@e94c054f">. Expected EA1_OutcomeAction, found MethodBindingMethodExpressionAdapter

The type "EA1_OutcomeAction" is the wrapper class. To debug, I've commented out all of the wrapper class out and all of the contents of the component (with the exception of the attribute declaration) and I'm still getting this error. It seems like a pretty deep Java error. Has anybody else seen this before?

Wrapper class

public with sharing class EA1_OutcomeAction{
   //Completely commented everything out.
}

Component Markup

<apex:component >
   <apex:attribute name="action" type="EA1_OutcomeAction" Description="The instance of Apex Class OutcomeAction"/>
</apex:component

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;}
}
0

2 Answers 2

2

action is standard attribute of standard salesforce visualforce tags so rename your action as shown below and it will work

<apex:page controller="EA1_DummyCode">
   <c:EA1_OutcomeAction myaction="{!act}"/>
</apex:page>
0

As I was coming here with the answer I find that Keith and Himanshu were already working on the right lines!

The issue was the attribute name being "Action" which seems to be a protected keyword. I renamed the attribute to "OutcomeAction" which resolved the issue.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .