I have a code like:
<p:dataTable style="padding-top: 5px" var="leaveDetails" value="#{userLeaveBean.leaveDetails}" id="leaveDataTable" editable="true">
<p:column headerText="Leave Starts on" width="230">
<p:calendar valueChangeListener="#{userLeaveBean.handleFromDateChanege}" value="#{leaveDetails.dtLeaveFromDate}" pattern="dd-MMM-yyyy" size="16" showOn="button" id="editFrom">
<p:ajax event="dateSelect"/>
</p:calendar>
<h:selectOneRadio value="#{leaveDetails.strStartTiming}" valueChangeListener="#{userLeaveBean.handleRadioFirstValueChange}">
<f:selectItem itemValue="morning" itemLabel="Morning"/>
<f:selectItem itemValue="afternoon" itemLabel="Afternoon" />
<p:ajax event="click"/>
</h:selectOneRadio>
</p:column>
<p:column headerText="Leave Ends on" width="230">
<p:calendar valueChangeListener="#{userLeaveBean.handleToDateChanege}" value="#{leaveDetails.dtLeaveToDate}" pattern="dd-MMM-yyyy" size="16" showOn="button" id="editTo">
<p:ajax event="dateSelect"/>
</p:calendar>
<h:selectOneRadio value="#{leaveDetails.strEndTiming}" valueChangeListener="#{userLeaveBean.handleRadioSecondValueChange}">
<f:selectItem itemValue="noon" itemLabel="Noon"/>
<f:selectItem itemValue="endofday" itemLabel="End Of Day"/>
<p:ajax event="click"/>
</h:selectOneRadio>
</p:column>
<p:column headerText="Days" width="40" id="total">
<h:outputText value="#{leaveDetails.totalLeaveDays}"/>
</p:column>
<p:column headerText="Creation" width="100">
<h:outputText value="#{leaveDetails.dtApplicationDate}">
<f:convertDateTime pattern="EEEE,dd-MMM-yyyy"/>
</h:outputText>
</p:column>
<p:column headerText="Status" width="100">
<h:outputText value="#{leaveDetails.strLeaveStatus}"/>
</p:column>
<p:column headerText="Edit" width="40" rendered="#{leaveDetails.strLeaveStatus == 'Canceled' or leaveDetails.strLeaveStatus == 'Availed'}">
<p:commandLink actionListener="#{userLeaveBean.editAppliedLeave}" title="Edit" disabled="true" update="leaveDataTable" immediate="true" partialSubmit="true">
<h:graphicImage url="resources/images/edit.JPG"/>
<f:attribute name="userId" value="#{employee.name}"/>
<f:attribute name="editFirstHalf" value="#{leaveDetails.strStartTiming}"/>
<f:attribute name="editSecondHalf" value="#{leaveDetails.strEndTiming}"/>
<f:attribute name="editFrom" value="#{leaveDetails.dtLeaveFromDate}"/>
<f:attribute name="editTo" value="#{leaveDetails.dtLeaveToDate}"/>
<f:attribute name="leaveId" value="#{leaveDetails.strLeaveId}"/>
</p:commandLink>
</p:column>
<p:column headerText="Edit" width="40" rendered="#{leaveDetails.strLeaveStatus != 'Canceled'}">
<p:commandLink actionListener="#{userLeaveBean.editAppliedLeave}" title="Edit" disabled="false" update="leaveDataTable" immediate="true" process="#this" >
<h:graphicImage url="resources/images/edit.JPG"/>
<f:attribute name="userId" value="#{employee.name}"/>
<f:attribute name="editFirstHalf" value="#{leaveDetails.strStartTiming}"/>
<f:attribute name="editSecondHalf" value="#{leaveDetails.strEndTiming}"/>
<f:attribute name="editFrom" value="#{leaveDetails.dtLeaveFromDate}"/>
<f:attribute name="editTo" value="#{leaveDetails.dtLeaveToDate}"/>
<f:attribute name="leaveId" value="#{leaveDetails.strLeaveId}"/>
</p:commandLink>
</p:column>
<p:column headerText="Cancel" width="60" rendered="#{leaveDetails.strLeaveStatus == 'Canceled' or leaveDetails.strLeaveStatus == 'Availed'}">
<p:commandLink actionListener="#{userLeaveBean.cancelForLeave}" title="Cancel Request" disabled="true" process="#this" update="leaveDataTable" immediate="false">
<h:graphicImage url="resources/images/cancel.gif"/>
<f:attribute name="userId" value="#{employee.name}"/>
<f:attribute name="leaveId" value="#{leaveDetails.strLeaveId}"/>
</p:commandLink>
</p:column>
<p:column headerText="Cancel" width="60" rendered="#{leaveDetails.strLeaveStatus != 'Canceled'}">
<p:commandLink actionListener="#{userLeaveBean.cancelForLeave}" title="Cancel Request" disabled="false" process="#this" update="leaveDataTable" immediate="false" ajax="true">
<h:graphicImage url="resources/images/cancel.gif"/>
<f:attribute name="userId" value="#{employee.name}"/>
<f:attribute name="leaveId" value="#{leaveDetails.strLeaveId}"/>
</p:commandLink>
</p:column>
</p:dataTable>
This part of code is written in a <p:datatable>.That means Row operation of a <p:datatable>.On clicking the <p:commandLink> some execution is happened, and I want it to reflect on the <p:datatable> immediatley. But it does not happen.
If I refresh the page, then the changes reflects for the row of the <p:datatable>. How can I modify my code to reflect the changes immediately.
Working on JSF2.0, primefaces 3.4.2, Jboss As7.1.1final and JDK6.0.
Bean is in #ViewScoped.
Please suggest.
Thanks in advance.
Related
I use jsf 2.2 and Primefaces 4.0 in my project. but I faced a problem . After Filter Primefaces Datatable. I want to show the filtered Row ditails in a dialog but after filter, Row ditails not show dialog box . Even Until Reload the page don't show Row Details in the dialog box . My Jsf Code Is ..........
<h:form id="Form_showRequest" style="font-size: 10pt;">
<input type="text" id="search" placeholder="Search now..."></input>
<p:growl id="MSG_grl" autoUpdate="false" showDetail="true"/>
<p:dataTable id="TBL_data" var="List_request" value="#{allRequestBean.requestDetailsList}" scrollable="true" widgetVar="reTab"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
scrollHeight=" 460" style="font-size: 10pt; font-family: serif;margin-bottom:0;">
<p:column headerText="Mobile No" style="width: 80px;" filterBy="#{List_request.mobileNumber}" >
#{List_request.mobileNumber}
</p:column>
<p:column headerText="User Name" style="width: 80px;">
#{List_request.userName}
</p:column>
<p:column headerText="Amount" style="width: 50px;">
#{List_request.rechargeAmount}
</p:column>
<p:column headerText="Cost" style="width: 50px;">
#{List_request.costAmount}
</p:column>
<p:column headerText="Service" style="width: 100px;">
#{List_request.serviceName}
</p:column>
<p:column headerText="Bank " style="width: 50px;">
#{List_request.bankName}
</p:column>
<p:column headerText="Bank Tran Id" style="width: 100px;">
#{List_request.bankTrankId}
</p:column>
<p:column headerText="Date Time" style="width: 150px;" >
#{List_request.rechargeDate}
</p:column>
<p:column headerText="Conformation Id" style="width: 100px;">
#{List_request.conformationId}
</p:column>
<p:column headerText="Status" style="width: 80px;">
<h:outputText value="#{List_request.rechargeStatusName}"/>
</p:column>
<p:column id="op" headerText="Option" style="width: 100px">
<p:commandButton id="but" value="Action" action="#{actionBean.allReRowDetails()}"
update=":Form_showRequest:PNL_action" style=" font-size: 10px" onclick="PF('widget_action').show();"
ajax="true" disabled="#{List_request.rechargeStatusId eq 4 or List_request.rechargeStatusId eq 5}">
<f:setPropertyActionListener value="#{List_request}" target="#{actionBean.allRequestBeanValue}"/>
</p:commandButton>
<p:commandLink id="requestDetails" value="Details" action="#{allRequestDetailsBean.rowDetails()}"
update=":Form_showRequest:PNL_request" oncomplete="PF('widget_request').show();" ajax="true" >
<f:setPropertyActionListener value="#{List_request}" target="#{allRequestDetailsBean.allRequestBeanValue}" />
</p:commandLink>
</p:column>
</p:dataTable>
<p:dialog id="Dialog_acton" header="Action" widgetVar="widget_action" modal="true">
<h:panelGrid id="PNL_action" style="margin-bottom:10px; width: 300px;" cellpadding="10">
<p:selectOneRadio id="action" columns="1" value="#{actionBean.actionType}">
<f:selectItem itemLabel="Resend" itemValue="1" />
<f:selectItem itemLabel="Complete" itemValue="4" />
<f:selectItem itemLabel="Cancel" itemValue="5" />
</p:selectOneRadio><br/>
<p:outputLabel value="Reason" style="width:20px; "/>
<p:inputTextarea value="#{actionBean.confirmId}" style="width: 250px" />
</h:panelGrid>
<p:commandButton value="Ok" action="#{actionBean.action()}" update="Form_showRequest:TBL_data,MSG_grl"
oncomplete="widget_action.hide()" style="width: 200px; margin-left: 50px;"/>
</p:dialog>
<p:dialog id="Dialog_request" header="Request Details Information" widgetVar="widget_request" showEffect="clip" hideEffect="fold" resizable="false" >
<p:panelGrid id="PNL_request" columns="2" style="width: 450px" >
<p:outputLabel value="Recharge Id :"/>
<p:outputLabel value=" #{allRequestDetailsBean.rechargeId}"/>
<p:outputLabel value="User Name:"/>
<p:outputLabel value=" #{allRequestDetailsBean.userName}"/>
<p:outputLabel value="Mobile Number :"/>
<p:outputLabel value=" #{allRequestDetailsBean.mobileNumber}"/>
<p:outputLabel value="Recharge Amount:"/>
<p:outputLabel value=" #{allRequestDetailsBean.rechargeAmount}"/>
<p:outputLabel value="Cost :"/>
<p:outputLabel value=" #{allRequestDetailsBean.costAmount}"/>
<p:outputLabel value="Number Type:"/>
<p:outputLabel value=" #{allRequestDetailsBean.numberType}"/>
<p:outputLabel value="Operator :"/>
<p:outputLabel value=" #{allRequestDetailsBean.operatorName}"/>
<p:outputLabel value="Service :"/>
<p:outputLabel value=" #{allRequestDetailsBean.serviceName}"/>
<p:outputLabel value="Bank Nmae:"/>
<p:outputLabel value=" #{allRequestDetailsBean.bankName}"/>
<p:outputLabel value="Bank Transaction Id:"/>
<p:outputLabel value=" #{allRequestDetailsBean.bankTrankId}"/>
<p:outputLabel value="Ip Address:"/>
<p:outputLabel value=" #{allRequestDetailsBean.ipAddress}"/>
<p:outputLabel value="Time:"/>
<p:outputLabel value=" #{allRequestDetailsBean.rechargeDate}"/>
<p:outputLabel value="Invoice No:"/>
<p:outputLabel value=" #{allRequestDetailsBean.invoiceNo}"/>
<p:outputLabel value="Conformation Id:"/>
<p:outputLabel value=" #{allRequestDetailsBean.conformationId}"/>
<p:outputLabel value="Status:"/>
<p:outputLabel value=" #{allRequestDetailsBean.rechargeStatusName}"/>
</p:panelGrid>
</p:dialog>
</h:form>
I Solved it by this code write in p:dataTable tag ....
filteredValue="#{allRequestDetailsBean.filteredRequest}"
and also create a list in allRequestDetailsBean
private List<AllRequestBean> filteredRequest;
I am in a little bit of trouble with my preRenderView-Event. My page also uses a commandbutton to submit data but unfortunately the preRenderView-Event is always called before the buttons action is invoked.
<h:body style="width:600px; ">
<ui:composition template="/common/master-layout.xhtml">
<ui:define name="title">#{message['app.page.main.title']}</ui:define>
<ui:debug
rendered="#{initParam['javax.faces.PROJECT_STAGE'] eq 'Development'}"
hotkey="x" />
<ui:define name="metadata">
<f:metadata>
<f:viewParam name="id" value="#{saisieDevisController.idDemande}" />
<f:event type="preRenderView"
listener="#{saisieDevisController.init}" />
</f:metadata>
</ui:define>
<ui:define name="content">
<p:fieldset legend="Programme" style="margin-top: 20px;">
<h:form id="etudeDemSaisieDevisForm">
<p:tabView id="etudeDemSaisieDevisTabView">
<p:tab id="programmeTab" title="Programme">
<h:panelGrid columns="4" cellpadding="10">
<h:outputText id="programmeInput" value="Programme"
style="font-weight:bold" />
<h:outputText for="programmeInput"
value="#{saisieDevisController.selectedDemande.idProgramme.codeProgImmobilier}" />
<h:outputText id="lotInput" value="Lot" style="font-weight:bold" />
<h:outputText for="lotInput"
value="#{saisieDevisController.selectedDemande.idBien.numLotCommercial}" />
<h:outputText id="nomAcqInput" value="Nom Acquereur"
style="font-weight:bold" />
<h:outputText for="nomAcqInput"
value="#{saisieDevisController.selectedDemande.idAcquereur.genreEtatCivil} #{saisieDevisController.selectedDemande.idAcquereur.prenomAcquereur} #{saisieDevisController.selectedDemande.idAcquereur.nomAcquereur}" />
</h:panelGrid>
</p:tab>
<p:tab id="datesFraisTab" title="Dates et frais">
<h:panelGrid columns="4" cellpadding="10">
<h:outputLabel value="Date de valité de devis"
style="font-weight:bold" />
<p:calendar
value="#{saisieDevisController.selectedDemande.lastDevis.datValidite}"
id="dateValiditeDevis" showOn="button" required="true">
<f:convertDateTime pattern="dd/MM/yyyy" />
</p:calendar>
<h:outputLabel value="Date butoire de chantier"
style="font-weight:bold" />
<p:calendar
value="#{saisieDevisController.selectedDemande.lastDevis.dateButoire}"
id="dateButoireDevis" showOn="button" required="true">
<f:convertDateTime pattern="dd/MM/yyyy" />
</p:calendar>
<h:outputText value="Frais de dossier" style="font-weight:bold" />
<p:selectOneMenu
value="#{saisieDevisController.selectedDemande.lastDevis.fraDossiers}"
style="width: 175px;">
<f:selectItem itemLabel="Choisir..." itemValue=""
noSelectionOption="true" />
<f:selectItem itemLabel="Aucun" itemValue="Aucun" />
<f:selectItem itemLabel="Déjà réglé" itemValue="Déjà réglé" />
<f:selectItem itemLabel="Charge Acquéreur"
itemValue="Charge Acquéreur" />
<f:selectItem itemLabel="Charge SNC" itemValue="Charge SNC" />
</p:selectOneMenu>
<h:outputLabel value="Date de plan de référence"
style="font-weight:bold" />
<p:calendar
value="#{saisieDevisController.selectedDemande.lastDevis.datPlanReference}"
id="datePlanRef" showOn="button" required="true">
<f:convertDateTime pattern="dd/MM/yyyy" />
</p:calendar>
<h:outputText value="Frais de pilotage" style="font-weight:bold" />
<p:selectOneMenu
value="#{saisieDevisController.selectedDemande.lastDevis.fraPilotage}"
style="width: 175px;">
<f:selectItem itemLabel="Choisir..." itemValue=""
noSelectionOption="true" />
<f:selectItem itemLabel="Oui" itemValue="Oui" />
<f:selectItem itemLabel="Non" itemValue="Non" />
<f:selectItem itemLabel="Pour mémoire" itemValue="Pour mémoire" />
</p:selectOneMenu>
<h:outputText value="Frais de plan" style="font-weight:bold" />
<p:selectOneMenu
value="#{saisieDevisController.selectedDemande.lastDevis.fraPlan}"
style="width: 175px;">
<f:selectItem itemLabel="Choisir..." itemValue=""
noSelectionOption="true" />
<f:selectItem itemLabel="Aucun" itemValue="Aucun" />
<f:selectItem itemLabel="Charge Acquéreur"
itemValue="Charge Acquéreur" />
<f:selectItem itemLabel="Charge SNC" itemValue="Charge SNC" />
</p:selectOneMenu>
</h:panelGrid>
</p:tab>
<p:tab id="devisTab" title="Devis">
<h:panelGrid columns="2" cellpadding="10">
<h:panelGrid columns="4" cellpadding="10">
<h:outputText id="numDevis" value="Numéro de devis"
style="font-weight:bold" />
<h:inputText for="numDevis"
value="#{saisieDevisController.selectedDemande.lastDevis.numDevis}" />
<h:outputText id="dateRecepDemande"
value="Date de la réception de la demande"
style="font-weight:bold" />
<h:outputText for="dateRecepDemande"
value="#{saisieDevisController.selectedDemande.dateDemande}">
<f:convertDateTime pattern="dd/MM/yyyy" />
</h:outputText>
<h:outputText id="dateSaisieDevis"
value="Date de saisie de la demande" style="font-weight:bold" />
<h:outputText for="dateSaisieDevis"
value="#{saisieDevisController.selectedDemande.dateSaisie}">
<f:convertDateTime pattern="dd/MM/yyyy" />
</h:outputText>
<h:outputText id="ficheOptionDevis" value="Fiche d'oprion"
style="font-weight:bold" />
<h:outputText for="ficheOptionDevis"
value="#{saisieDevisController.selectedDemande.ficheOption}" />
</h:panelGrid>
</h:panelGrid>
</p:tab>
<p:tab id="previsualisationTab" title="Prévisualisation">
<h:panelGrid columns="2" cellpadding="10">
</h:panelGrid>
</p:tab>
</p:tabView>
<p:panel>
<ui:include src="ligneDataTable.xhtml" />
</p:panel>
<h:panelGrid columns="4" cellpadding="10"
style="text-align: center;margin-left: 25%;width: 50%; margin-right: 25%; margin-top: 30px; background-color:RGB(225,240,233)">
<h:outputText id="chargeSncHt" value="Charge SNC HT"
style="font-weight:bold" />
<h:outputText for="chargeSncHt"
value="#{saisieDevisController.selectedDemande.idDemande}" />
<h:outputText id="chargeAcqHt" value="Charge Acq HT"
style="font-weight:bold" />
<h:outputText for="chargeAcqHt" value="200" />
<h:outputText id="chargeSncTtc" value="Charge SNC TTC"
style="font-weight:bold" />
<h:outputText for="chargeSncTtc" value="0" />
<h:outputText id="chargeAcqTtc" value="Charge ACQ TTC"
style="font-weight:bold" />
<h:outputText for="chargeAcqTtc" value="0" />
</h:panelGrid>
<h:panelGrid columns="3" cellpadding="10" style="margin: 0 auto;">
<p:commandButton value="Valider" id="saveDemande"
styleClass="ui-priority-primary"
action="#{saisieDevisController.updateValidate}"
style="margin-left:10px;margin-top:10px;margin-bottom:10px;height:125%;width:90px">
</p:commandButton>
<p:commandButton value="Annuler" id="cancelDemande"
styleClass="ui-priority-primary"
action="#{saisieDevisController.updateCancel}"
style="margin-left:10px;margin-top:10px;margin-bottom:10px;height:125%;width:90px"
immediate="true" />
<p:commandButton value="Suspendre" id="suspendDemande"
styleClass="ui-priority-primary"
action="#{saisieDevisController.updateSuspend}"
style="margin-left:10px;margin-top:10px;margin-bottom:10px;height:125%;width:90px">
</p:commandButton>
</h:panelGrid>
</h:form>
</p:fieldset>
</ui:define>
</ui:composition>
Controller:
#Component
#Scope("view")
public class SaisieDevisController implements Serializable {
//...
#ManagedProperty("#{demandeController.selectedDemande}")
private DemandeDto selectedDemande;
private Long idDemande;
//...
public String init(){
if (!FacesContext.getCurrentInstance().isPostback()) {
selectedDemande = new DemandeDto();
selectedDemande.setIdBien(new BienDto());
listDescriptifs = new ArrayList<DescriptifDto>();
selectedDecriptif = new DescriptifDto();
actualize();
}
return null;
}
public String initLigne(){
ligneToSave = new LigneDto();
listLots = new ArrayList<LotDto>();
listLots = lotService.findAll();
listSituations = new ArrayList<SituationDto>();
listSituations = situationService.findAll();
listUnites = new ArrayList<UniteDto>();
listUnites = uniteService.findAll();
return "/views/demande/saisieDevis/addLigne?faces-redirect=true";
}
public void actualize(){
selectedDemande = saisieDevisService.findById(idDemande);
selectedDemande.setLastDevis(selectedDemande.getLastDevis());
}
With the JSF Lifecycle in mind, it is not really possible to have an preRenderView-Event being triggered before the "Invoke application" phase is finished. Please double-check the following:
Is the action invoked at all? In case of an converter/validation error the "invoke action" phase is skipped and the response is rendered instantly.
Are you calling the method from somewhere else? saisieDevisController.init sounds pretty generic. Maybe a trigger like #PostConstruct calls it earlier (nested).
Hope it helps...
i have created datatable with four selectOneMenu in it
whenever i change the first selectOneMenu values of second selectOneMenu need to be populated on the same row and again on the selection of second selectOneMenu third needs to populate
i had done this by passing row number value to each selectOneMenu (with intention which particular selectOneMenu user must has clicked on) but whenever i pass the value with f:param i am getting null value on the controller but same can be printed with outputText on datatable
please guide
<t:dataTable id="insertTaskDataTable" border="1"
value="#{insertTask.taskList}" var="taskInfo" rowIndexVar="row"
iterationStatusVar="it">
<t:column>
<h:inputHidden id="id" value="#{row}"/>
</t:column>
<t:column>
<f:facet name="header">#{bundle['GROUP_HEADER']}</f:facet>
<h:selectOneMenu id="taskGroup" value="#{taskInfo.groupList.comboValue}" onchange="document.getElementById('addTask:filterButton').click();">
<f:param name="idTaskGroup" value="#{row}"/>
<t:outputText name="id" value="#{row}"/>
<f:selectItems value="#{taskInfo.groupList.comboValues}" />
</h:selectOneMenu>
</t:column>
<t:column>
<f:facet name="header">#{bundle['ACTIVITY_HEADER']}</f:facet>
<h:selectOneMenu id="taskActivity" value="#{taskInfo.activityList.comboValue}">
<f:ajax render="taskSubActivity" listener="#{insertTask.handleActivityChange}"></f:ajax>
<f:selectItems value="#{taskInfo.activityList.comboValues}" />
</h:selectOneMenu>
</t:column>
<t:column>
<f:facet name="header">#{bundle['SUBACTIVITY_HEADER']}</f:facet>
<h:selectOneMenu id="taskSubActivity" value="#{taskInfo.subActivityList.comboValue}">
<f:selectItems value="#{taskInfo.subActivityList.comboValues}" />
</h:selectOneMenu>
</t:column>
<t:column>
<f:facet name="header">#{bundle['COMPLEXTIY_HEADER']}</f:facet>
<h:selectOneMenu id="taskComplexity" value="#{taskInfo.complexityList.comboValue}">
<f:selectItems value="#{taskInfo.complexityList.comboValues}" />
</h:selectOneMenu>
</t:column>
<t:column>
<f:facet name="header">#{bundle['BENCHMARK_EFFORT_HEADER']}</f:facet>
<t:inputText value="#{taskInfo.benchMarkHrs}" />
<t:outputLabel value="hrs"/>
<t:inputText value="#{taskInfo.benchMarkMin}" />
<t:outputLabel value="min"/>
</t:column>
<t:column>
<f:facet name="header">#{bundle['DESCRIPTION_HEADER']}</f:facet>
<t:inputText value="#{taskInfo.taskdescription}" />
</t:column>
</t:dataTable>
</t:div>
<a4j:commandButton id="filterButton" style="visibility:hidden;display:none" action="#{insertTask.handleGroupChange}" render="insertTaskDataTable" />
Hi Guys i got solution
here it is,
<t:dataTable id="insertTaskDataTable" border="1"
value="#{insertTask.taskList}" var="taskInfo" rowIndexVar="row"
iterationStatusVar="it" rendered="#{insertTask.taskList[0] != null}" >
<t:column>
<f:facet name="header">#{bundle['GROUP_HEADER']}</f:facet>
<h:selectOneMenu id="taskGroup" value="#{taskInfo.groupList.comboValue}" onchange="document.getElementById('addTask:insertTaskDataTable:#{row}:groupButton').click();">
<f:selectItems value="#{taskInfo.groupList.comboValues}" />
</h:selectOneMenu>
</t:column>
<t:column>
<f:facet name="header">#{bundle['CATEGORY_HEADER']}</f:facet>
<h:selectOneMenu id="taskCategory" value="#{taskInfo.categoryList.comboValue}" onchange="document.getElementById('addTask:insertTaskDataTable:#{row}:categoryButton').click();">
<f:selectItems value="#{taskInfo.categoryList.comboValues}" />
</h:selectOneMenu>
</t:column>
<t:column>
<f:facet name="header">#{bundle['ACTIVITY_HEADER']}</f:facet>
<h:selectOneMenu id="taskActivity" value="#{taskInfo.activityList.comboValue}" onchange="document.getElementById('addTask:insertTaskDataTable:#{row}:activityButton').click();">
<f:selectItems value="#{taskInfo.activityList.comboValues}" />
</h:selectOneMenu>
</t:column>
<t:column>
<f:facet name="header">#{bundle['SUBACTIVITY_HEADER']}</f:facet>
<h:selectOneMenu id="taskSubActivity" value="#{taskInfo.subActivityList.comboValue}" onchange="document.getElementById('addTask:insertTaskDataTable:#{row}:subActivityButton').click();">
<f:selectItems value="#{taskInfo.subActivityList.comboValues}" />
</h:selectOneMenu>
</t:column>
<t:column>
<f:facet name="header">#{bundle['COMPLEXTIY_HEADER']}</f:facet>
<h:selectOneMenu id="taskComplexity" value="#{taskInfo.complexityList.comboValue}">
<f:selectItems value="#{taskInfo.complexityList.comboValues}" />
</h:selectOneMenu>
</t:column>
<t:column>
<f:facet name="header">#{bundle['BENCHMARK_EFFORT_HEADER']}</f:facet>
<t:outputText value="#{taskInfo.benchMarkHrs}" style="height: 10px; width: 50px;" />
<t:outputLabel value=" hrs"/>
<t:outputText value="#{taskInfo.benchMarkMin}" style="height: 10px; width: 50px;" />
<t:outputLabel value="min"/>
</t:column>
<t:column>
<f:facet name="header">#{bundle['DESCRIPTION_HEADER']}</f:facet>
<t:inputText value="#{taskInfo.taskdescription}" />
<h:commandButton id="groupButton" style="visibility:hidden;display:none" actionListener="#{insertTask.handleGroupChange}">
<f:attribute name="groupid" value="#{row}" />
</h:commandButton>
<h:commandButton id="categoryButton" style="visibility:hidden;display:none" actionListener="#{insertTask.handleCategoryChange}">
<f:attribute name="categoryid" value="#{row}" />
</h:commandButton>
<h:commandButton id="activityButton" style="visibility:hidden;display:none" actionListener="#{insertTask.handleActivityChange}">
<f:attribute name="activityid" value="#{row}" />
</h:commandButton>
<h:commandButton id="subActivityButton" style="visibility:hidden;display:none" actionListener="#{insertTask.handleSubActivityChange}">
<f:attribute name="subactivityid" value="#{row}" />
</h:commandButton>
</t:column>
</t:dataTable>
The best solution for this is "t:selectOneRow" from tomahawk library
Java Side
private Long selectedRowIndex = -1L; //Along with it's getters and setters
JSP Side
<t:dataTable var="var" value="#{bean.beanList}"
style="border: 1px solid black;">
<t:column>
<t:selectOneRow value="#{bean.selectedRowIndex}" groupName="selection"
id="selectBtn">
</t:selectOneRow>
</t:column>
<t:column>
<f:facet name="header">
<h:outputLabel value="Names" />
</f:facet>
<t:outputText value="#{var.names}" />
</t:column>
<t:column>
<f:facet name="header">
<h:outputLabel value="Address" />
</f:facet>
<t:outputText value="#{var.address}" />
</t:column>
When the "selectedRowIndex" is -1L, that means nothing in the row is selected.
Whenever you need to set the page to no radio selected, then set this value to -1L.
The result should be something like this...
I am using primefaces 3.0 and jsf 2.0.
I have prepared client master which add client using wizard and at the same time reflected in datatable. Then I have updated edit utility in datatable. Then I have added delete button in datatable and try call delete method of bean.
But when I click on delete button wizard validation for adding client is executed.
So I have created another file ClientEditdatatable.xhtml and included in clientmaster.xhtmlbut same result remain.
Now I want to add delete utility in datatable. I have tried many tricks to do it.
I just want to pass client id through action listener,get deleted and refresh datatable but command button not executing method.
Kindly advice.
My code as below:
ClientMaster.xhtml
<h:body>
<ui:composition template="/template/mainLayout.xhtml" >
<ui:define name="pageContent">
<h:form id="cm">
<p:growl life="5000" showDetail="true" showSummary="true" id="mymessage" autoUpdate="true"/>
<br/>
user id :#{sessionScope.USER_ID};
<br/>
<p:wizard widgetVar="wiz" flowListener="#{clientUitility.onFlowProcess}" showNavBar="true" >
<p:tab id="personal" title="Personal" >
<p:panel id="personal1" header="Personal Details">
<!-- <h:messages errorClass="error"/> -->
<h:panelGrid columns="6" styleClass="grid">
<h:outputText value="First Name:*" />
<p:inputText required="true" label="FirstName"
value="#{clientUitility.client.firstName}" >
</p:inputText>
<h:outputText value="Middle Name:*" />
<p:inputText required="true" label="MidddleName"
value="#{clientUitility.client.middleName}" />
<h:outputText value="Last Name:*" />
<p:inputText required="true" label="LastName"
value="#{clientUitility.client.lastName}" />
<h:outputText value="Login ID:* " />
<p:inputText required="true" label="LoginID"
value="#{clientUitility.client.loginID}"/>
<h:outputText value="Password:* " />
<p:inputText required="true" label="Password"
value="#{clientUitility.client.password}"/>
</h:panelGrid>
</p:panel>
</p:tab>
<p:tab id="address" title="Address" >
<p:panel id="address1" header="Adress Details">
<!-- <h:messages errorClass="error"/> -->
<h:panelGrid columns="6" styleClass="grid">
<h:outputText value="Address:*" />
<p:inputText required="true" label="Address1"
value="#{clientUitility.client.address1}" />
<h:outputText />
<p:inputText label="Address2"
value="#{clientUitility.client.address2}" />
<h:outputText />
<p:inputText label="Address3"
value="#{clientUitility.client.address3}" />
<h:outputText value="City:* " />
<p:inputText required="true" label="City"
value="#{clientUitility.client.city}" />
<h:outputText value="Pincode:* " />
<p:inputText required="true" label="Pincode"
value="#{clientUitility.client.pincode}" />
<h:outputText value="State:* " />
<p:inputText required="true" label="State"
value="#{clientUitility.client.state}" />
</h:panelGrid>
</p:panel>
</p:tab>
<p:tab id="contact" title="Contact" >
<p:panel id="contact1" header="Contact Information">
<!-- <h:messages errorClass="error"/> -->
<p:panelGrid columns="4" styleClass="grid">
<h:outputText value="Mobile:* " />
<p:inputText required="true" label="MobileNo"
value="#{clientUitility.client.mobileNo}" />
<h:outputText value="Email ID: "/>
<p:inputText label="EmailID"
value="#{clientUitility.client.emailID}" />
<h:outputText value="STD Code: "/>
<p:inputText label="STDCode"
value="#{clientUitility.client.stdCode}" />
<h:outputText value="Phone No: "/>
<p:inputText label="PhoneNo"
value="#{clientUitility.client.phoneNo}" /> </p:panelGrid>
</p:panel>
</p:tab>
<p:tab id="confirm" title="Confirmation" >
<p:panel id="confirm1" header="Confirm and Submit">
<h:panelGrid columns="6" styleClass="grid" >
<h:outputText value="First Name: " />
<h:outputText styleClass="outputLabel"
value="#{clientUitility.client.firstName}" />
<h:outputText value="Middle Name: " />
<h:outputText styleClass="outputLabel"
value="#{clientUitility.client.middleName}" />
<h:outputText value="Last Name: " />
<h:outputText styleClass="outputLabel"
value="#{clientUitility.client.lastName}" />
<h:outputText value="Login ID: " />
<h:outputText styleClass="outputLabel"
value="#{clientUitility.client.loginID}"/>
<h:outputText value="Password: " />
<h:outputText styleClass="outputLabel"
value="#{clientUitility.client.password}"/>
<h:outputText/>
<h:outputText/>
<h:outputText value="Address: " />
<h:outputText styleClass="outputLabel"
value="#{clientUitility.client.address1}" />
<h:outputText />
<h:outputText styleClass="outputLabel"
value="#{clientUitility.client.address2}" />
<h:outputText />
<h:outputText styleClass="outputLabel"
value="#{clientUitility.client.address3}" />
<h:outputText value="City: " />
<h:outputText styleClass="outputLabel"
value="#{clientUitility.client.city}" />
<h:outputText value="State: " />
<h:outputText styleClass="outputLabel"
value="#{clientUitility.client.state}" />
<h:outputText value="Pincode: " />
<h:outputText styleClass="outputLabel"
value="#{clientUitility.client.pincode}" />
<h:outputText value="Email ID: " />
<h:outputText styleClass="outputLabel"
value="#{clientUitility.client.emailID}" />
<p:commandButton id="addClient" immediate="true" value="Add Client" actionListener="#{clientUitility.save}" oncomplete="wiz.loadStep (wiz.cfg.steps [0], true)" update="#parent,:cm:clientList"> <!-- update="#parent,:cm:clientList" -->
</p:commandButton>
</h:panelGrid>
</p:panel>
</p:tab>
</p:wizard>
<ui:include id="ce" src="ClientEditDatatable.xhtml"/>
</h:form>
</ui:define>
</ui:composition>
</h:body>
ClientEditDatatable.xhtml
<h:body>
<h:form id="fce">
<p:confirmDialog message="Delete client?" severity="alert" widgetVar="confirmDeleteClient" visible="false" appendToBody="true">
<p:commandButton value="Yes" update=":cm:fce:clientList" oncomplete="confirmDeleteClient.hide()" actionListener="#{clientUitility.deleteRecord}" >
</p:commandButton>
<p:commandButton value="No" onclick="confirmDeleteClient.hide()" type="button" />
</p:confirmDialog>
<p:dataTable var="client" value="#{clientUitility.clientAll}" id="clientList" editable="true"
rowKey="#{client.clientID}" paginator="true" rows="10" rowsPerPageTemplate="10,15,20">
<p:column headerText="First Name" style="width:125px" filterBy="#{user.firstname}" sortBy="#{client.firstName}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.firstName}" />
</f:facet>
<f:facet name="input">
<h:outputText value="#{client.firstName}" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Middle Name" style="width:125px" filterBy="#{client.middleName}" sortBy="#{client.middleName}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.middleName}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.middleName}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Last Name" style="width:125px" filterBy="#{client.lastName}" sortBy="#{client.lastName}" >
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.lastName}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.lastName}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Login ID" style="width:125px" filterBy="#{client.loginID}" sortBy="#{client.loginID}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.loginID}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.loginID}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Password" style="width:125px" filterBy="#{client.password}" sortBy="#{client.password}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.password}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.password}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Address1" style="width:125px" filterBy="#{client.address1}" sortBy="#{client.address1}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.address1}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.address1}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Address2" style="width:125px" filterBy="#{client.address2}" sortBy="#{client.address2}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.address2}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.address2}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Address3" style="width:125px" filterBy="#{client.address3}" sortBy="#{client.address3}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.address3}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.address3}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="City" style="width:125px" filterBy="#{client.city}" sortBy="#{client.city}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.city}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.city}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="State" style="width:125px" filterBy="#{client.state}" sortBy="#{client.state}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.state}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.state}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Pincode" style="width:125px" filterBy="#{client.pincode}" sortBy="#{client.pincode}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.pincode}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.pincode}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Mobile No" style="width:125px" filterBy="#{client.mobileNo}" sortBy="#{client.mobileNo}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.mobileNo}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.mobileNo}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="STD Code" style="width:125px" filterBy="#{client.stdCode}" sortBy="#{client.stdCode}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.stdCode}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.stdCode}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Phone No" style="width:125px" filterBy="#{client.phoneNo}" sortBy="#{client.phoneNo}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.phoneNo}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.phoneNo}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Email ID" style="width:125px" filterBy="#{client.emailID}" sortBy="#{client.emailID}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.emailID}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.emailID}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Edit" style="width:50px">
<p:rowEditor />
</p:column>
<p:ajax event="rowEdit" listener="#{clientUitility.editRowListner}" update=":cm:mymessage"/>
<p:column headerText="Delete" style="width:50px">
<p:commandButton id="deleteClient" value="Delete" onclick="confirmDeleteClient.show()" title="Delete this Client" styleClass="ui-icon-closethick">
</p:commandButton>
</p:column>
</p:dataTable>
</h:form>
</h:body>
clientUtility.java
#ManagedBean
#ViewScoped
public class ClientUitility {
private ClientBean client = new ClientBean();
private List<ClientBean> clientAll = new ArrayList<ClientBean>();
/** Creates a new instance of ClientUitility */
public ClientUitility() {
clientAll = new ArrayList<ClientBean>();
int userID = Integer.parseInt(FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("USER_ID").toString());
clientAll = ClientService.GenerateClientList(userID);
}
public List<ClientBean> getClientAll() {
return clientAll;
}
public void setClientAll(List<ClientBean> clientAll) {
this.clientAll = clientAll;
}
public ClientBean getClient() {
return client;
}
public void setClient(ClientBean client) {
this.client = client;
}
public String onFlowProcess(FlowEvent event) {
System.out.println("Current wizard step:" + event.getOldStep());
System.out.println("Next step:" + event.getNewStep());
System.out.println("First name : " + client.getfirstName());
System.out.println("Last name : " + client.getlastName());
System.out.println("Age name : " + client.getloginID());
return event.getNewStep();
}
public void editRowListner(RowEditEvent rowEditEvent) {
try {
ClientBean updatedClient = (ClientBean) rowEditEvent.getObject();
System.out.println("Client First Name: " + updatedClient.getfirstName());
ClientService.EditClient(updatedClient);
FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(null, new FacesMessage("Updated", updatedClient.getfirstName() + " " + updatedClient.getlastName()));
} catch (Exception e) {
e.getMessage();
}
}
public void deleteRecord(ActionEvent actionEvent) {
try {
//System.out.println("Client ID: " + actionEvent.getComponent().getAttributes().get("cID").toString());
System.out.println("delete client of User ID: " + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("USER_ID").toString());
FacesMessage msg = new FacesMessage("Client Deleted", "");
FacesContext.getCurrentInstance().addMessage(null, msg);
} catch (Exception e) {
e.printStackTrace();
}
}
public void save(ActionEvent actionEvent) { client.setuserID(Integer.parseInt(FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("USER_ID").toString()));
System.out.println("Client ID : " + client.getclientID());
System.out.println("User ID : " + client.getuserID());
ClientService.AddClient(client);
client = new ClientBean();
clientAll = ClientService.GenerateClientList(Integer.parseInt(FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("USER_ID").toString()));
FacesMessage msg = new FacesMessage("Client Created", "");
FacesContext.getCurrentInstance().addMessage(null, msg);
}
}
Kindly advice where am I mistaking?
You can't and shouldn't nest forms.
In the ClientMaster.xhtml, replace
<ui:include id="ce" src="ClientEditDatatable.xhtml"/>
</h:form>
by
</h:form>
<ui:include id="ce" src="ClientEditDatatable.xhtml"/>
See also:
commandButton/commandLink/ajax action/listener method not invoked or input value not updated
I have datatable and a dropdown within a xhtml. If I am deleting p:datatable code within this page then I am able to call the valueChangeListener of dropdown , but if p:datatable is present in xhtml, then I am not able to call it.
Xhtml code is
<ui:define name="content">
<f:view>
<h:form id="accountSummaryForm" prependId="false">
<h:selectBooleanCheckbox id="checkbox" value="true" />
<h:outputLabel value="Show certificates preview on sumit"></h:outputLabel>
<h:outputLabel value="Show certificates preview on sumit"></h:outputLabel>
<h:outputText align="left"
value="Value is #{reqSummaryHandler.certNumber}" />
<p:dataTable id="reqActList" paginatorAlwaysVisible="true"
var="reqInfo" value="#{reqSummaryHandler.certActListModel}"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
paginator="true" rows="#{label.accountList_defaultNumberOfRows}"
selectionMode="single"
rowsPerPageTemplate="#{label.accountList_numberOfRows}" width="60%">
<p:column style="text-align:center;" filterBy="" sortBy=""
width="5%">
<f:facet name="header">
<h:outputLabel value="#{label.certNumber}" />
</f:facet>
<h:outputText align="left" value="#{reqInfo.certNumber}" />
</p:column>
<p:column style="text-align:center;" filterBy="" sortBy=""
width="5%">
<f:facet name="header">
<h:outputLabel value="Version" />
</f:facet>
<h:outputText align="left" value="#{reqInfo.certVersionNbrString}" />
</p:column>
<p:column style="text-align:center;" filterBy="" sortBy=""
width="5%">
<f:facet name="header">
<h:outputLabel value="Insured" />
</f:facet>
<ui:repeat value="#{reqInfo.clientList}" var="insuredInfo">
<h:outputText align="left"
value="#{insuredInfo.generalPartyInfo.nameInfo.commName.commercialName}" />
</ui:repeat>
</p:column>
<p:column style="text-align:center;" filterBy="" sortBy=""
width="5%">
<f:facet name="header">
<h:outputLabel value="Certificate Holder" />
</f:facet>
<ui:repeat value="#{reqInfo.certificateHolderInfoList}"
var="certHoldInfo">
<h:outputText align="left"
value="#{certHoldInfo.additionalInterest.generalPartyInfo.nameInfo.commName.commercialName}" />
</ui:repeat>
</p:column>
<p:column style="text-align:center;" filterBy="" sortBy=""
width="5%">
<f:facet name="header">
<h:outputLabel value="Activity Performed" />
</f:facet>
<h:outputText align="left" value="#{reqInfo.effectiveTypeCd}" />
</p:column>
<p:column style="text-align:center;" filterBy="" sortBy=""
width="5%">
<f:facet name="header">
<h:outputLabel value="Certificate Status" />
</f:facet>
<h:outputText align="left" value="#{reqInfo.statusCd}" />
</p:column>
<p:column style="text-align:center;" filterBy="" sortBy=""
width="5%">
<f:facet name="header">
<h:outputLabel value="Third Party" />
</f:facet>
<h:outputText align="left"
value="#{reqInfo.certWordingEndorsementInd}" />
</p:column>
<p:column style="text-align:center;" filterBy="" sortBy=""
width="5%">
<f:facet name="header">
<h:outputLabel value="Manual Form" />
</f:facet>
<h:outputText align="left" value="#{reqInfo.manualEntryInd}" />
</p:column>
<p:column style="text-align:center;" filterBy="" sortBy=""
width="5%">
<f:facet name="header">
<h:outputLabel value="Manual Addendum" />
</f:facet>
<h:outputText align="left" value="#{reqInfo.mnlAddendumInd}" />
</p:column>
<p:column style="text-align:center;" filterBy="" sortBy=""
width="5%">
<f:facet name="header">
<h:outputLabel value="Path" />
</f:facet>
<p:cellEditor>
<f:facet name="output">
<h:outputText align="left" value="#{reqInfo.routePathCd}"
readonly="true" />
</f:facet>
<f:facet name="input">
<h:selectOneMenu value="#{reqInfo.routePathCd}">
<f:selectItem itemLabel="Issue Distribute" itemValue="A" />
<f:selectItem itemLabel="Send to Underwriter" itemValue="B" />
<f:selectItem itemLabel="Issue Do Not Distribute"
itemValue="C" />
</h:selectOneMenu>
</f:facet>
</p:cellEditor>
<p:rowEditor rendered="#{reqInfo.statusCd eq 'A'}" />
</p:column>
<p:column style="text-align:center;white-space: normal;nowrap">
<f:facet name="header">
<h:outputLabel value="Action" />
</f:facet>
<ui:repeat value="#{reqInfo.availableFunctions.functionNameArray}"
var="linkInfo">
<p:commandLink id="View" value="#{linkInfo}" ajax="false" />
<br />
</ui:repeat>
</p:column>
</p:dataTable>
<p:spacer width="50" height="0"></p:spacer>
<p:spacer width="50" height="0"></p:spacer>
<p:spacer width="3" height="0"></p:spacer>
<p:spacer width="3" height="0"></p:spacer>
<p:spacer width="3" height="0"></p:spacer>
<p:spacer width="3" height="0"></p:spacer>
<p:spacer width="3" height="0"></p:spacer>
<p:spacer width="3" height="0"></p:spacer>
<h:outputLabel value="Assign Path" style="font-weight:bold" />
<p:spacer width="5" height="10" />
<h:selectOneMenu id="dropdown2"
valueChangeListener="#{reqSummaryHandler.DoPathProcessing1}"
value="#{reqSummaryHandler.certNumber}" onchange="submit();">
<f:selectItem itemLabel="Issue Distribute" itemValue="A" />
<f:selectItem itemLabel="Send to Underwriter" itemValue="B" />
<f:selectItem itemLabel="Issue Do Not Distribute" itemValue="C" />
</h:selectOneMenu>
</h:form>
</f:view>
</ui:define>
And listener code is
public void DoPathProcessing1(ValueChangeEvent event) {
String newValue = (String) event.getNewValue();
System.out.println("Path"
+ certActListModel.getRowData().getRoutePathCd());
certActListModel.getRowData().setRoutePathCd(newValue);
System.out.println("value is " + newValue);
}
Any idea why it is not working?
I am using jsf-api-2.0.3 and primefaces-2.2.1
You are using both the value and the valueChangeListener attributes of the drop down component. Why would you do this?
Just having value="#{reqSummaryHandler.certNumber} will call setCertNumber(String certNumber) in your managed bean. Why not just put this code into the setter method?