java - JSF 2.0 HTMLCommandButton doesn't call ActionListener in Custom Component -
i'm developing popup plain jsf on jboss 7.1 , i'm trying add command button in renderer of popup-class. class popup extends uipanel. popup inside h:form.
the code adds button popup:
private static final string id_field_tag = "id"; private static final string html_div_tag = "div";
[...]
writer.startelement(html_div_tag, component); writer.writeattribute(id_field_tag, konstanten.getpopupfooterid(), id_field_tag); writer.write("\n"); if(popup.isshowdialogbuttons()){ htmlcommandbutton cancelbutton = new htmlcommandbutton(); component.getchildren().add(cancelbutton); cancelbutton.setid(konstanten.getpopupfootercancelbuttonid()); cancelbutton.setvalue(popup.getcanceltext()); if (!popup.getcancelaction().equals("")) { string expression = "#{"+popup.getcancelaction()+"}"; methodexpression methodexpression = expressionhelper.expression_helper. generatemethodexpression(expression, null, new class<?>[] { actionevent.class }); cancelbutton.addactionlistener(new methodexpressionactionlistener( methodexpression)); } else { cancelbutton.setonclick("hidepopup('" + componentid + "')"); } cancelbutton.encodeall(context); } writer.endelement(html_div_tag);
the button visible, nothing happens when clicking it, except page-reload.
popup.getcancelaction() returns "nameofthebean.nameofthemethod".
there no error messages.
thanks help!
edit: tried replace htmlcommandbutton htmlcommandlink see, whether form problem or not. link looks it's working, still nothing gets called.
the problem was, buttons not correctly added jsf component tree. i've added them child component , ignored them in encodechildren()-methode.
if knows better solution love know it, please don't hesitate answer question!
Comments
Post a Comment