I am facing a problem in the form submit, the first thing is without @this my <p:commandButton> is not calling my Managedbean.
And when I added @this it's calling my managed bean with empty form data.
I am not able to figure out exactly what I am missing here.the structure is
employee.xhtml:
<ui:composition template="employee/employeeTemplate.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<ui:define name="mainContent">
<ui:include src="employee/employeeEditForm.xhtml"></ui:include>
</ui:define>
</ui:composition>
And my employeeTemplate.xhtml is :
<ui:composition template="../../templates/sidebarLayout.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:define name="sidebarContent">
<p:panel styleClass="panelContainer">
<p:panel styleClass="panelHeader"
header="#{o:translate('Employee List')}"></p:panel>
<p:panel styleClass="panelSpacing">
<h:form id="employeeListForm">
<ui:include src="employeeList.xhtml">
</ui:include>
<ui:include src="addNewEmployee.xhtml">
</ui:include>
</h:form>
</p:panel>
</p:panel>
</ui:define>
</ui:composition>
And my Dialogbox is in addNewEmployee.xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
xmlns:ui="http://java.sun.com/jsf/facelets">
<p:commandButton id="addEmployeeBtn"
value="#{o:translate('Add New Employee')}"
styleClass="btnAction"
style="float: right;"
oncomplete="PF('dlgExample').show();">
</p:commandButton>
<p:dialog id="dlgExample"
header="#{o:translate('Dlg Example')}"
widgetVar="dlgExample" dynamic="true" width="750" height="600" appendTo="@(body)">
<h:form id="dlgExampleForm">
<p:outputLabel for="val1"
value="#{o:translate('Employee Type')}:" />
<p:selectOneMenu value="#{myManagedBean.selectedEmp.type}" id="val1">
<f:selectItems value="#{myManagedBean.employeeTypes}" />
</p:selectOneMenu>
<p:commandButton id="cancelButton"
value="#{o:translate('Cancel')}" update=":mainContent,:msgs"
oncomplete="PF('dlgExample').hide();" />
<p:commandButton style="float: right;"
styleClass="pull_right btnAction"
actionListener="#{myManagedBean.saveEmployee}"
value="#{o:translate('Save')}" process="@this"
update=":mainPage,:msgs" >
<p:confirm header="Confirmation" message="Are you sure you want to Save?"
icon="ui-icon-alert" />
</p:commandButton>
</h:form>
</p:dialog>
</ui:composition>
Any help will be grately apreciated.