jsf 2 - <h:commandButton> not working inside <ui:define> -
i created facelet template called loginregistertemplate.xhtml. when use in template client , place in it, method in managed bean not invoked. without template button working fine. why happening?
<ui:composition template="resources/css/faceletstemplates/loginregistertemplate.xhtml"> <ui:define name="top"> login page </ui:define> <ui:define name="content"> <div align="center"> <h:panelgrid columns="3" columnclasses="rightalign,leftalign,leftalign"> <h:outputlabel value="username:" for="username"/> <h:inputtext id="username" label="username" required="true" value="#{loginbean.username}" /> <h:message for="username" /> <h:outputlabel value="password:" for="password"/> <h:inputtext id="password" label="password" required="true" value="#{loginbean.password}" /> <h:message for="password" /> </h:panelgrid><br/> <h:button value="back home" outcome="home"/> <h:commandbutton id="login" value="login" action="#{loginbean.dologin}"/> </div> </ui:define> </ui:composition> </h:body>
the simple <h:button>
next it, on other side, working fine.
here body of template file:
<h:body> <div id="top"> <ui:insert name="top">top</ui:insert> </div> <div id="content" class="center_content"> <ui:insert name="content">content</ui:insert> </div> </h:body>
i have looked here: h:commandlink / h:commandbutton not being invoked couldn't find problem causes that.
thanks!
why h:commandbutton
not working?
your problem number 1 in answer have checked.
uicommand , uiinput components must placed inside uiform component, e.g.
<h:form>
.
why h:button
working ?
from h:button
docs:
render html "input" element of type "button". value of component rendered button text , outcome of component used determine target url activated onclick.
so ...
jsf put h:button
outcome
value in javascript function executed @ onclick
event. execute action
of h:commandbutton
on form submit post
method, there should form submit.
Comments
Post a Comment