• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can't bind method expression to htmlcommandbutton  RSS feed

 
Carlos Conti
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I have the following class structure in a JSF project with facelets:

ManagedBeanAncestor class, and

subclasses A,B,C

The purpose ManagedBeanAncestor is to hold 3 HtmlCommandButton non-static instances and 3 non-static methods : Save,Cancel and Delete. As you might guess, these are Entity managedbeans whose purpose is to interface with POJO objects and the Persistence context.

Since I have to build all jspx pages in a similar way, I decided this structure in order to need only to implement in A,B and C backing bean every specific Save,Cancel and Delete behaviour. Together with an ui:include file, containing in the front-end the layout of the three buttons, I guessed including that template in every A.jspx, B.jspx and C.jspx, would solve the problem.

However I am finding myself now that the backbean methods Save() Cancel() and Delete() are not called neither in the backing bean (A,B,C or the superinstance), although defining the bindings of the HtmlCommandButtons to the commandButton tags in the jspx file through the "binding" attribute of the commandButton tag. I am not setting the action attribute, because in a phase listener after the renderresponse phase, I attach MethodExpression's to the involved subclass. The attach method should parse the expressión automatically (according to the documentation) so no error in the EL expression is possible. Moreover after attaching the MethodExpression, while debugging I can see a MethodExpression was successfullyattached to the HtmlCommandButton in the backing bean. I already tried setting the MethodExpression through the action attribute, but again no luck.

As you can imagine when clicking on the button.. nothing happens.

Can you guess any reason for that? I have been struggling with it for a few hours now, and cannot figure anything out on what can be the cause.
Would appreciate some light on the matter if possible. It was hard for me to explaing. Hope the problem is more or less clear.

Many thanks in advance for your help
Carlos
 
Carlos Conti
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well unfortunately nobody wasted time in soliving this...

sorry dudes...

I SIMPLY FORGOT TO ENCLOSE BUTTONS IN A FORM....

NOT BAD FOR MY FIRST POST...

cheers
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!