I have a backing-bean containing a few methods that share the same names but have different signatures, e.g.:
public void voteUp( Member member, ObjectA object ) { ... }
public void voteUp( Member member, ObjectB object ) { ... }
In the example, ObjectA
and ObjectB
types don't share anything in common.
In my Facelet, I call actions this way:
<h:form>
<h:commandButton action="#{backingBean.voteUp(membre, objectA)}" ... />
</h:form>
...
<h:form>
<h:commandButton action="#{backingBean.voteUp(membre, objectB)}" ... />
</h:form>
But it seems that sometimes (not randomly, but probably depending on which signature is first defined in my backing-bean), the method called by one of these EL is the wrong one, and I get one of those exceptions:
serverError: class javax.faces.el.EvaluationException Cannot convert com.test.ObjectA@116c1800 of type class com.test.ObjectA to class com.test.ObjectB
Since I'm giving my EL an object of type ObjectA
, why is it calling the method with the ObjectB
signature anyway? Am I forgetting something about Java basics here, or is it my EL interpretor that screws up?
I use GlassFish 3.1.2.
[Edit] just to make clear that everything else is ok in my code, when I rename one of the two methods in this example, everything works just fine.