jsf 2 - JSF inputfield values gone after second button click -
the problem i'm trying press button -> go backing bean -> set boolean false/true , show popup accordingly. if popup shows -> call method , execute it.
the above working, input fields i've got after first button click seem lost when i'm clicking button in popup panel. parameters i've got after first click (they in backing bean object) gone second click (in popup). be?
it's in 1 form , buttons , inputfields etc in 1 a4j:region.. there no validations errors behind scenes.
i've got following backing bean (note intentionally didn't put whole bb in there al injects etc..):
@managedbean(name = "dossierintreatmentbb") @viewscoped public class dossierintreatmentbackingbean { /** show center popup. */ private boolean showcenterpopup; /** continue assign without report. */ private boolean continueassignwithoutreport; public void assign() throws ioexception { if (!continueassignwithoutreport) { externaloffice eo = annucomplocal.findofficebycrestracode(getentity().getservicetreatment()); showcenterpopup = officelevel.center.equals(eo.getservicetype().getofficelevel()) } if (!showcenterpopup) { dossierintreatmentdossierlocal.assign(); //refreshes entity setdto(null); if (!dossiercontext.iseditallowed(getdossier())) { string url = getrequestcontextpath() + "/dossier/consult/detail.jsf?id=%s"; redirect(url, getdossier().getid().tostring()); } } } /** * assign without report. * @throws ioexception signals i/o exception has occurred. */ public void assignwithoutreport() throws ioexception { showcenterpopup = false; continueassignwithoutreport = true; assign(); } ... needed getters , setters ...
and view (assign.xhtml):
<!doctype composition public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <ui:fragment xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ccffdecorate="http://java.sun.com/jsf/composite/ccffdecorate" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j"> <a4j:region> <h:panelgrid layout="block" styleclass="rsplitpanel2" columns="2" rendered="#{not empty entitybb.entity}"> "some input fields" </h:panelgrid> <h:panelgroup layout="block" styleclass="rbuttonpanel"> <h:commandbutton value="#{appmessages['general.action.save']}"> <a4j:ajax render="dossierintreatmentpanel :messages centerpopupgroup" listener="#{entitybb.assign}" status="ajaxstatus" oncomplete="#{rich:component('centerpopup')}.show()" /> </h:commandbutton> <h:commandbutton value="#{appmessages['general.action.cancel']}"> <a4j:ajax execute="@this" render="dossierintreatmentpanel :messages" listener="#{entitybb.cancel}" status="ajaxstatus" /> </h:commandbutton> </h:panelgroup> <h:panelgroup id="centerpopupgroup"> <rich:popuppanel id="centerpopup" modal="true" autosized="true" rendered="#{entitybb.showcenterpopup}" onmaskclick="#{rich:component('centerpopuppanel')}.hide()"> <div class="rbuttonpanel"> <h:commandbutton value="#{appmessages['general.action.next']}"> <a4j:ajax listener="#{entitybb.assignwithoutreport()}" status="ajaxstatus" oncomplete="#{rich:component('centerpopup')}.hide();" /> </h:commandbutton> <h:commandbutton value="#{appmessages['general.action.cancel']}"> <a4j:ajax listener="#{entitybb.cancel}" limitrender="true" status="ajaxstatus" onclick="#{rich:component('centerpopup')}.hide(); return false;" /> </h:commandbutton> </div> </rich:popuppanel> </h:panelgroup> </a4j:region>
dit.xhtml:
<!doctype composition public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:e="http://minfin.regondes2/entity" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j" xmlns:l="http://minfin.regondes2/layout"> <ui:include src="assignblock/assign.xhtml" />
dossier.xhtml:
<h:form> <ui:include src="dit.xhtml" /> </h:form>
i'm sorry not making views more compact, since i'm guessing problem located in view i'm showing whole structure.
finally found it.
had add 2 different a4j:regions. 1 form , 1 popup panel..
Comments
Post a Comment