Problems with control of primefaces components by Managed Bean - jsf-2

I hope somebody could help me with the trouble I am having with JSF 2 and Primefaces 3.0M3.
the problem is that the back bean methods do not fired from any component in the layoutunit 'center' they are inside a form and nothing happens, even I tried to update the components with remoteCommand, autoUpdate of the outputpanel, commandButton with action and actionListener and nothing, there is no error message. In the layoutunit west works the components well, renders the outputpanel (pfpInfo) of the center layoutunit but I do not know what is happening.
here is the code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:head>
<title>Articulos</title>
</h:head>
<h:body>
<link rel="stylesheet" type="text/css" href="../css/estilos.css" />
<p:layout fullPage="true" id="lay">
<p:layoutUnit position="north" size="100" resizable="false"
closable="false" collapsible="false">
<img src="../images/logo.jpg" alt="PLL"
style="width: 413px; height: 83px;" align="left"></img>ss
<img src="../images/tel.jpg" alt="PLR"
style="width: 413px; height: 83px;" align="right"></img>
</p:layoutUnit>
<p:layoutUnit position="west" size="200" header="Categorías"
resizable="false" closable="false" collapsible="false">
<h:form id="frWest">
<p:growl id="message" showDetail="true" globalOnly="true"
autoUpdate="true"></p:growl>
<p:tree id="treeSingle" value="#{controlMBean.raizArbol}"
var="rama" dynamic="true" selectionMode="single"
selection="#{controlMBean.ramaElegida}" expanded="true">
<p:ajax event="select"
update=":frCenter:pfSeg :frCenter:pfpInfo :frCenter:pfpIma"
listener="#{controlMBean.procesaInformacionArt}"></p:ajax>
<p:treeNode>
<h:outputText value="#{rama}" styleClass="encabezadoUiLight" />
</p:treeNode>
</p:tree>
</h:form>
</p:layoutUnit>
<p:layoutUnit position="center">
<h:form id="frCenter">
<p:outputPanel id="pfSeg" rendered="true">
<p:outputPanel id="pfpIma" rendered="#{not controlMBean.cargado}">
<img src="../images/luchadores.jpg" />
</p:outputPanel>
<p:outputPanel id="pfpInfo" rendered="#{controlMBean.cargado}"
autoUpdate="true">
<p:dataTable dynamic="true" var="prnda" rowKey="#{prnda.id}"
value="#{controlMBean.infoArts}" paginator="true" rows="10"
selectionMode="single" paginatorAlwaysVisible="false"
selection="#{controlMBean.artElegido}"
rendered="#{controlMBean.cargado}">
<p:ajax event="rowUnselect"
listener="#{prestalana.deseleccionar}"></p:ajax>
<f:facet name="header">Articulo(s)</f:facet>
<p:ajax update=":frCenter:ppImg :frCenter:pgInfo"
oncomplete="prnd.show()" event="rowSelect"
listener="#{controlMBean.elegirFila}"></p:ajax>
<p:column sortBy="#{prnda.id}">
<f:facet name="header">
<h:outputText value="Id" />
</f:facet>
<h:outputText value="#{prnda.id}" />
</p:column>
<p:column sortBy="#{prnda.articulo}">
<f:facet name="header">
<h:outputText value="Modelo" />
</f:facet>
<h:outputText value="#{prnda.articulo}" />
</p:column>
<p:column sortBy="#{prnda.marca}">
<f:facet name="header">
<h:outputText value="Marca" />
</f:facet>
<h:outputText value="#{prnda.marca}" />
</p:column>
<p:column sortBy="#{prnda.edo}">
<f:facet name="header">
<h:outputText value="Ubicación" />
</f:facet>
<h:outputText value="#{prnda.edo}" />
</p:column>
<p:column sortBy="#{prnda.stsArticulo}">
<f:facet name="header">
<h:outputText value="Estatus" />
</f:facet>
<h:outputText value="#{prnda.stsArticulo} " />
</p:column>
<p:column sortBy="#{prnda.precio}">
<f:facet name="header">
<h:outputText value="Precio" />
</f:facet>
<h:outputText value="$ #{prnda.precio}" />
</p:column>
</p:dataTable>
<p:commandButton action="#{controlMBean.probar2}"
actionListener="#{controlMBean.probar}" value="Prueba"></p:commandButton>
</p:outputPanel>
<br />
<h:outputText value="#{controlMBean.mensaje}"
styleClass="textoUiLight" id="hotMen" />
</p:outputPanel>
<p:remoteCommand actionListener="#{controlMBean.probar}"
name="pruebaRc" update=":frCenter:ppImg"></p:remoteCommand>
<p:dialog appendToBody="true" dynamic="true" header="Info Prenda"
onShow="pruebaRc" widgetVar="prnd" resizable="false" width="750"
height="550" showEffect="fold" position="center"
hideEffect="explode">
<p:outputPanel id="ppImg" autoUpdate="true">
<h:panelGrid columns="2" id="pgInfo">
<p:galleria transitionInterval="3000" var="i"
value="#{controlMBean.imagenes}"
panelWidth="#{controlMBean.width}"
panelHeight="#{controlMBean.height}"
frameHeight="#{controlMBean.height/4}"
frameWidth="#{controlMBean.width/4}" effect="flash">
<p:graphicImage id="img" height="#{i.alto}" width="#{i.ancho}"
value="#{controlMBean.ruta}#{i.nombre}.jpg" />
</p:galleria>
<h:panelGrid columns="2" width="350">
<h:outputLabel value="ID:" styleClass="etiqueta" />
<h:outputText value="#{controlMBean.artElegido.id}"
styleClass="resultado" />
<h:outputLabel value="Prenda:" styleClass="etiqueta" />
<h:outputText
value="#{controlMBean.artElegido.prenda} adasd"
styleClass="resultado" />
<h:outputLabel value="Precio:" styleClass="etiqueta" />
<h:outputText value="$#{controlMBean.artElegido.precio}"
styleClass="resultado" />
<h:outputLabel value="Marca:" styleClass="etiqueta" />
<h:outputText value="#{controlMBean.artElegido.marca}"
styleClass="resultado" />
<h:outputLabel value="Sucursal:" styleClass="etiqueta" />
<h:outputText value="#{controlMBean.artElegido.suc}"
styleClass="resultado" />
<h:outputLabel value="Descripcion:" styleClass="etiqueta" />
<h:outputText value="#{controlMBean.artElegido.descr}"
styleClass="resultado" style="width:300px;height:100px;" />
</h:panelGrid>
</h:panelGrid>
</p:outputPanel>
</p:dialog>
</h:form>
</p:layoutUnit>
</p:layout>
</h:body>
</html>

Related

Howto directly edit in p:datatable

i use Primefaces 5.1.
I have a datatable and want to edit directly in the cells.
It works, when i use editMode="row" with a p:rowEditor, but i want
to edit directly in cells without the rowEditor.
Wit editMode="cell" i get no CellEditEvent.
How is that possible?
best regards
Here is my JSF Page:
<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
template="${pageContext.request.contextPath}/templates/default.xhtml">
<ui:define name="content">
<h1>Hannymede Berechtigungsverwaltung</h1>
<p:panel header="Berechtigungsverwaltung">
<p:fieldset legend="Gruppe" style="margin-bottom:20px">
<h:form id="roleSelectorForm">
<p:selectOneMenu id="roleSelector" onchange="submit()"
value="#{authorityController.currentRole}"
converter="RoleConverter" hideNoSelectionOption="false">
<f:selectItem id="noRole" itemLabel="Gruppe auswählen"
itemValue="" noSelectionOption="true" />
<f:selectItems value="#{roleController.allRoles}" var="_role"
itemValue="#{_role}" itemLabel="#{_role.toString()}" />
</p:selectOneMenu>
</h:form>
</p:fieldset>
<p:fieldset legend="Berechtigungen der Gruppe"
style="margin-bottom:20px">
<h:form id="dataTableForm">
<p:dataTable id="authoritiesTable" editable="true" editMode="cell"
value="#{authorityController.currentRole.authoritys}" var="tw"
rowKey="#{tw.id} - #{tw.hashCode()}" rowIndexVar="rowIndex">
<p:ajax event="rowEdit"
listener="#{authorityController.authorityChanged}"></p:ajax>
<p:column sortBy="#{tw.voClassDesc.businessName}"
filterBy="#{tw.voClassDesc.businessName}">
<f:facet name="header">
<h:outputText value="Objekt" />
</f:facet>
<h:outputText value="#{tw.voClassDesc.businessName}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Lesen" />
</f:facet>
<p:cellEditor>
<f:facet name="input">
<p:selectBooleanCheckbox value="#{tw.autRead}" />
</f:facet>
<f:facet name="output">
<p:selectBooleanCheckbox value="#{tw.autRead}" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Erstellen" />
</f:facet>
<p:cellEditor>
<f:facet name="input">
<p:selectBooleanCheckbox value="#{tw.autInsert}" />
</f:facet>
<f:facet name="output">
<p:selectBooleanCheckbox value="#{tw.autInsert}" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Ändern" />
</f:facet>
<p:cellEditor>
<f:facet name="input">
<p:selectBooleanCheckbox value="#{tw.autUpdate}" />
</f:facet>
<f:facet name="output">
<p:selectBooleanCheckbox value="#{tw.autUpdate}" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Löschen" />
</f:facet>
<p:cellEditor>
<f:facet name="input">
<p:selectBooleanCheckbox value="#{tw.autDelete}" />
</f:facet>
<f:facet name="output">
<p:selectBooleanCheckbox value="#{tw.autDelete}" />
</f:facet>
</p:cellEditor>
</p:column>
</p:dataTable>
</h:form>
</p:fieldset>
</p:panel>
</ui:define>
<ui:define name="title">Hannymede Berechtigungsverwaltung</ui:define>
</ui:composition>
Hello,
I did read the manual.
So looks my datatable in cellEdit Mode.
<p:dataTable id="authoritiesTable" editable="true" editMode="cell"
value="#{authorityController.currentRole.authoritys}" var="tw"
rowKey="#{tw.id} - #{tw.hashCode()}" rowIndexVar="rowIndex">
<p:ajax event="cellEdit"
listener="#{authorityController.authorityChanged}" update=":dataTableForm:authoritiesTable"></p:ajax>
and my Bean Method does not get the events
public void authorityChanged(CellEditEvent e) {
Object oldValue = e.getOldValue();
that's the table in "cellEdit" Mode - where i get no events.
best regards
When using editMode="cell" you need to use the cellEdit event instead of rowEdit. In addition, your ajax listener should be a bean method with the following signature: public void onCellEdit(CellEditEvent event)
So in your example, replace <p:ajax event="rowEdit" ... /> by <p:ajax event="cellEdit" ... /> and check your bean method
public void authorityChanged(CellEditEvent event) {
Object oldValue = event.getOldValue();
Object newValue = event.getNewValue();
if(newValue != null && !newValue.equals(oldValue)) {
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Cell Changed", "Old: " + oldValue + ", New:" + newValue);
FacesContext.getCurrentInstance().addMessage(null, msg);
}
}
References: PrimeFaces showcase and PrimeFaces 5.1 User Guide (pages 163 and 171)

jsf inputtext returns nothing, when I called print method

Why, when I call print method filter returnt null?
<ui:define>
<h:form>
<div>
<div>
<span>
<h:form>
<p:panelgrid>
...
<p:outputLabel value="Исполнитель-инженер :"/>
<h:inputText id="Eng" value="#{issueMoscowBean.changeIssue.engineerInf}"/>
...
close tags
and PrintMEthod
#Named
#Scope("session")
public class IssueMoscowBean implements Serializable {
...
public void saveOpen() throws CloneNotSupportedException {
if (listOpenI.contains(current)) {
System.out.println("CURRENT IN " + current.getEngineerInf());
listOpenI.set(listOpenI.indexOf(current), changeIssue);
System.out.println("Change IN " + changeIssue.getEngineerInf());
...
}
Console out is:
CURRENT IN null
Change IN null
<ui:composition template="/templates/layout.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"
xmlns:c="http://java.sun.com/jsp/jstl/core"
>
<ui:define name="content">
<style>
.colStyle1 { width: 25% !important;
}
.colStyle2 { width: 85% !important;
}
</style>
<h:form id="form">
<div style="width:88%; margin:auto !important; text-align: center;">
<p:tabMenu activeIndex="2" style=" width:100%; font-size: 14px !important; margin:0px auto !important; ">
<p:menuitem value="#{issueMoscowBean.getAllI()}" url="/modules/core/views/all.xhtml" onclick="#{issueMoscowBean.setFirstOpen()}"/>
<p:menuitem value="#{issueMoscowBean.getNewI()}" url="/modules/core/views/new.xhtml" />
<p:menuitem value="#{issueMoscowBean.getOpenI()}" url="#" />
<p:menuitem value="#{issueMoscowBean.getSetI()}" url="/modules/core/views/set.xhtml"/>
<p:menuitem value="#{issueMoscowBean.getExecI()}" url="/modules/core/views/execute.xhtml"/>
<p:menuitem value="#{issueMoscowBean.getClI()}" url="/modules/core/views/close.xhtml"/>
<p:menuitem value="#{issueMoscowBean.getRetI()}" url="/modules/core/views/return.xhtml"/>
</p:tabMenu>
<br/>
<br/>
<p:panelGrid style="padding-top: 0">
<p:selectOneMenu value="#{issueMoscowBean.param}" style="width: 20% !important; height: 100px">
<f:selectItem itemLabel="Выбрать критерий" itemValue="10" />
<f:selectItem itemLabel="По номеру заявки" itemValue="0" />
<f:selectItem itemLabel="По серийному номеру устройства" itemValue="1" />
<f:selectItem itemLabel="По ID регистраиции в ПС" itemValue="2" />
<f:selectItem itemLabel="По контактному лицу банка-клиента" itemValue="3" />
</p:selectOneMenu>
<h:inputText id="myFilter_text" value="#{issueMoscowBean.filter}" style="float: left;width: auto !important"/>
<p:commandButton value="Поиск" update="#all" ajax="true" style="float: left;width: auto !important"/>
</p:panelGrid>
<div style="width: 100%;padding-bottom: 5%;height: 75%">
<span style="float: left; width: 25%">
<p:dataTable id="dataTable" var="mem" value="#{issueMoscowBean.listOpenI}" widgetVar="Заявки"
style="width:100% !important; text-align: left; width: 100%;height: 100% !important; overflow-y: auto;overflow-x: auto;font-family: Cambria;background-color: white"
selection="#{issueMoscowBean.current}" selectionMode="single" rowKey="#{mem.docId}" rowStyleClass="#{mem.status eq 'Новая' ? 'new':
null}">
<p:ajax event="rowSelect" update=":form:issueDetailForm:display" />
<p:column filterMatchMode="contains" sortBy="#{mem.docId}" headerText="Список всех заявок" style="font-family: Cambria">
<h:outputText value="Время получения наряда:#{mem.taskRetrieved}" title="View" style="font-size: 15px !important;"/>
<br/>
<h:outputText value="№ серийный устройства:#{mem.atmSerial}" title="View" style="font-size: 15px !important;"/>
<br/>
<h:outputText value="Город:#{mem.city}" title="View" style="font-size: 15px !important;"/>
</p:column>
</p:dataTable>
</span>
<span style="float: left;width: 75%;height: available">
<h:form id="issueDetailForm" rendered="#{issueMoscowBean.openIsEmptyTAble()}" >
<p:panelGrid id="display" columns="2" columnClasses="colStyle1,colStyle2" style="margin:0 auto;width: 100%;" >
<f:facet name="header">
<p:outputPanel>
<h:outputText value="Просмотр данных заявки"/>
</p:outputPanel>
</f:facet>
<h:outputText value="№ документа ССС :"></h:outputText>
<h:outputText value="#{issueMoscowBean.changeIssue.docId}"/>
<h:outputText value="№ наряда :"></h:outputText>
<h:outputText value="#{issueMoscowBean.changeIssue.naryadRecId}"/>
<h:outputText value="Тип наряда :"></h:outputText>
<h:outputText value="#{issueMoscowBean.changeIssue.naryadType}"/>
<h:outputText value="TransmasterID :"></h:outputText>
<h:outputText value="#{issueMoscowBean.changeIssue.transmasterID}"/>
<h:outputText value="Модель устройства :"></h:outputText>
<h:outputText value="#{issueMoscowBean.changeIssue.atmModel}"/>
<h:outputText value="№ серийный устройства:"></h:outputText>
<h:outputText value="#{issueMoscowBean.changeIssue.atmSerial}"/>
<h:outputText value="Районный центр :"></h:outputText>
<h:outputText value="#{issueMoscowBean.changeIssue.rc}"/>
<h:outputText value="Область :"></h:outputText>
<h:outputText value="#{issueMoscowBean.changeIssue.oblast}"/>
<h:outputText value="Город :"></h:outputText>
<h:outputText value="#{issueMoscowBean.changeIssue.city}"/>
<h:outputText value="Адрес :"></h:outputText>
<h:outputText value="#{issueMoscowBean.changeIssue.adress}"/>
<h:outputText value="Название организации установки:"></h:outputText>
<h:outputText value="#{issueMoscowBean.changeIssue.org}"/>
<h:outputText value="Время сбоя :"></h:outputText>
<h:outputText value="#{issueMoscowBean.changeIssue.issueCreated}"/>
<h:outputText value="Код ошибки :"></h:outputText>
<h:outputText value="#{issueMoscowBean.changeIssue.errorCode}"/>
<h:outputText value="MSTATUS_MDATA :"></h:outputText>
<h:outputText value="#{issueMoscowBean.changeIssue.mstatus_mdata}"/>
<h:outputText value="№ инцидента ITSM :"></h:outputText>
<h:outputText value="#{issueMoscowBean.changeIssue.incidentNumber}"/>
<h:outputText value="Дата инцидента в ITSM :"></h:outputText>
<h:outputText value="#{issueMoscowBean.changeIssue.incidentCreated}"/>
<h:outputText value="Дата наряда в ITSM :"></h:outputText>
<h:outputText value="#{issueMoscowBean.changeIssue.naryadCreated}"/>
<h:outputText value="Тип сбоя в ITSM :"></h:outputText>
<h:outputText value="#{issueMoscowBean.changeIssue.srbCode}"/>
<h:outputText value="Описание для ССС:"></h:outputText>
<h:outputText value="#{issueMoscowBean.changeIssue.sssDescription}"/>
<h:outputText value="Cтатус сейфа :"></h:outputText>
<h:outputText value="#{issueMoscowBean.changeIssue.safeStatus}"/>
<h:outputText value="Код закрытия :"></h:outputText>
<h:outputText value="#{issueMoscowBean.changeIssue.closeStstus}"/>
<h:outputText value="Время получения наряда :"></h:outputText>
<h:outputText value="#{issueMoscowBean.changeIssue.taskRetrieved}"/>
<h:outputText value="Время последнего обновления :"></h:outputText>
<h:outputText value="#{issueMoscowBean.changeIssue.taskLastUpdated}"/>
<h:outputText value="Источник последнего обновления :"></h:outputText>
<h:outputText value="#{issueMoscowBean.changeIssue.taskLastUpdatedBy}"/>
<p:outputLabel value="Тип обслуживания :">
<p:message for="LevelService" id="wrongTypeService" />
</p:outputLabel>
<p:selectOneMenu id="LevelService" value="#{issueMoscowBean.changeIssue.taskLevelService}">
<f:selectItem itemLabel="ПСО" itemValue="1" />
<f:selectItem itemLabel="Разовое" itemValue="2" />
<p:ajax event="blur" update="wrongTypeService"/>
</p:selectOneMenu>
<p:outputLabel value="Номер договора :">
<p:message for="NumIssue" id="wrongNumIssue" />
</p:outputLabel>
<h:inputText id="NumIssue" value="#{issueMoscowBean.changeIssue.numIssue}" size="100" />
<p:outputLabel value="Дата начала обслуживания :"/>
<p:calendar id="DateBegin" value="#{issueMoscowBean.tempDate4}" locale="ru" pattern="MM/dd/yyyy HH:mm:ss" />
<p:outputLabel value="Время устранения неисправности :"/>
<h:inputText id="Time" value="#{issueMoscowBean.changeIssue.sla}" size="100" />
<p:outputLabel value="Исполнитель-инженер :"/>
<h:inputText id="Eng" value="#{issueMoscowBean.changeIssue.engineerInf}"/>
<p:outputLabel value="Дата и время передачи заявки инженеру :"/>
<p:calendar id="SendEng" value="#{issueMoscowBean.tempDate5}" locale="ru" pattern="MM/dd/yyyy HH:mm:ss" />
<p:outputLabel value="Тип работ :"></p:outputLabel>
<p:selectOneMenu value="#{issueMoscowBean.changeIssue.taskWorkValue}" style="width: 100%">
<f:selectItem itemLabel="Ремонт" itemValue="1" />
<f:selectItem itemLabel="Профилактика" itemValue="2" />
<f:selectItem itemLabel="Апгрейд" itemValue="2" />
<f:selectItem itemLabel="Запуск в эксплуатацию" itemValue="2" />
</p:selectOneMenu>
<p:outputLabel value="Номер заявки вендора :"/>
<h:inputText id="NumVendor" value="#{issueMoscowBean.changeIssue.numIssueVendor}" size="100" />
<h:outputText value="Cтатус :"></h:outputText>
<h:outputText value="#{issueMoscowBean.changeIssue.status} " />
<f:facet name="footer">
<p:commandButton value="Отменить изменения" update="issueDetailForm" process="#this" action="#{issueMoscowBean.back}" immediate="true" />
<p:commandButton value="Cохранить изменения" update="issueDetailForm" process="#this" action="#{issueMoscowBean.saveOpen}" immediate="true" />
<p:commandButton value="Назначить заявку" update=":form:dataTable, :growl" oncomplete="issueDialog2.show()" actionListener="#{issueMoscowBean.setI()}"/>
<p:commandButton value="Отменить Заявку" update=":form:issueDetailForm:display" process="#this" action="#{issueMoscowBean.setShowForm(1)}" immediate="true" />
<p:panelGrid id="display2" columns="2" columnClasses="colStyle1,colStyle2" rendered="#{issueMoscowBean.showForm}">
<h:outputText value="Опишите причину отмены :"></h:outputText>
<p:inputTextarea value="#{issueMoscowBean.changeIssue.closeComment}" cols="10"/>
<p:commandButton value="Отправить" update=":form:dataTable" process="#this" action="#{issueMoscowBean.returnIOpen()}" />
<p:commandButton value="Отмена" update=":form:issueDetailForm:display" process="#this" action="#{issueMoscowBean.setShowForm(0)}" immediate="true" />
</p:panelGrid>
</f:facet>
</p:panelGrid>
</h:form>
</span>
</div>
</div>
</h:form>
<p:growl id="growl" showDetail="true" life="5000" />
</ui:define>
</ui:composition>

Clearing form fields after invalidation JSF

Ok i have the following problem: In my web app i have the CRUD all one page via dialogs controls of Primefaces. In the new dialog i have some validators. For example: when a user does not fill the necessary fields for form submission obviously the form doesn't submit. But when i close de New dialog and open it up again, the validation messages are still there! How can i get rid of this? I want a fresh new page (without accumulated validation errors) every time a dialogs open up! How that can be done?
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
template="./../../resources/templates/baseTemplate.xhtml">
<ui:define name="content">
<f:view id="vRoot">
<p:fieldset legend="Gerenciar público">
<h:form id="frmPublicos">
<!-- Exibição de mensagens gerais -->
<p:growl id="gMessages" sticky="false" globalOnly="true" />
<!-- Exibição da lista de públicos -->
<p:dataTable id="dtPublicos"
value="#{publicoBean.lstDataTablePublico}"
paginator="true" rows="5"
rowsPerPageTemplate="5,10"
paginatorPosition="bottom"
paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
var="atual">
<!-- Every time dialog opens validation messages should be cleaned -->
<f:facet name="header">
<p:commandButton id="cbViewNovo"
value="Novo" type="button"
styleClass="cbViewNovo"
onclick="dlgNovo.show();"
update=":dlgNovoPublico"
process="#this">
<p:resetInput target=":dlgNovoPublico"/>
</p:commandButton>
</f:facet>
<!-- Colunas de edição e exclusão -->
<p:column>
<f:facet name="header">
<h:outputLabel value="Editar"/>
</f:facet>
<p:commandButton id="cbViewEditar"
image="ui-icon-pencil"
title="Editar"
update=":frmEditar:pEditarPublico"
oncomplete="dlgEditar.show();">
<f:setPropertyActionListener value="#{atual}" target="#{publicoBean.publicoSelecionado}" />
</p:commandButton>
</p:column>
<p:column>
<f:facet name="header">
<h:outputLabel value="Excluir"/>
</f:facet>
<p:commandButton id="cbViewExcluir" onclick="dlgExcluir.show();"
icon="ui-icon-close" title="Excluir">
<f:setPropertyActionListener value="#{atual}" target="#{publicoBean.publicoSelecionado}" />
</p:commandButton>
</p:column>
<p:column>
<f:facet name="header">
Nome
</f:facet>
<h:outputLabel id="olViewNomePublico" value="#{atual.nmePublico}"/>
</p:column>
<p:column>
<f:facet name="header">
Tipo de público
</f:facet>
<h:outputLabel id="olViewTipoPublico" value="#{atual.tdTipoPublico}"/>
</p:column>
</p:dataTable>
</h:form>
<!-- Caixa de diálogo de inclusão -->
<p:dialog id="dlgNovoPublico"
widgetVar="dlgNovo"
modal="true"
header="Novo público"
resizable="false">
<h:form id="frmNovo">
<p:panel id="pNovoPublico">
<p:messages id="mNovoMessages" redisplay="false" />
<p:panelGrid columns="2">
<p:outputLabel id="olNovoNomePublico" value="Nome:" for="itNovoNomePublico"/>
<p:inputText id="itNovoNomePublico" value="#{publicoBean.nome}" required="true"
requiredMessage="Digite o nome do público."/>
<p:outputLabel id="olNovoTipoPublico" for="somNovoTipoPublico" value="Tipo de público:"/>
<p:selectOneMenu id="somNovoTipoPublico"
value="#{publicoBean.tipoPublicoSelecionado}"
effect="fade"
converter="#{publicoBean.conversor}"
required="true"
requiredMessage="Selecione um tipo de público."
>
<f:selectItem itemLabel="Selecione um item..." itemValue=""/>
<f:selectItems value="#{publicoBean.lstMenuTipoPublico}" var="atual" itemLabel="#{atual.label}" itemValue="#{atual}"></f:selectItems>
</p:selectOneMenu>
<p:commandButton value="Cancelar" immediate="true" onclick="dlgNovo.hide()"/>
<p:commandButton id="cbNovoSalvar" value="Salvar"
actionListener="#{publicoBean.cadastrarPublico}"
oncomplete="handleSalvo(xhr, status, args);"
update=":frmPublicos:dtPublicos :frmNovo :frmPublicos:gMessages"
ajax="true"/>
</p:panelGrid>
</p:panel>
</h:form>
</p:dialog>
<!-- Caixa de diálogo de exclusão -->
<p:confirmDialog id="dialogoExcluir" message="Deseja realmente excluir?"
header="Excluir público" severity="alert"
widgetVar="dlgExcluir">
<h:form id="frmExcluir">
<p:commandButton id="cbExcluirCancelar" value="Cancelar" onclick="dlgExcluir.hide()" type="button" />
<p:commandButton id="cbExcluirContinuar" value="Continuar"
update=":frmPublicos:dtPublicos :frmPublicos:gMessages"
oncomplete="dlgExcluir.hide()"
actionListener="#{publicoBean.excluirPublico}"/>
</h:form>
</p:confirmDialog>
<!-- Caixa de diálogo de edição -->
<p:dialog id="dialogoEditar" widgetVar="dlgEditar" header="Editar público"
resizable="false" modal="true">
<h:form id="frmEditar">
<p:panel id="pEditarPublico">
<p:messages id="mEditarMessages" redisplay="false" />
<p:panelGrid columns="2">
<p:outputLabel id="olEditarNomePublico" value="Nome:" for="itEditarNomePublico"/>
<p:inputText id="itEditarNomePublico" value="#{publicoBean.publicoSelecionado.nmePublico}" required="true"
requiredMessage="Digite o nome do público."/>
<p:outputLabel id="olEditarTipoPublico" for="somEditarTipoPublico" value="Tipo de público:"/>
<p:selectOneMenu id="somEditarTipoPublico"
value="#{publicoBean.publicoSelecionado.tdTipoPublico}"
effect="fade"
converter="#{publicoBean.conversor}"
required="true"
requiredMessage="Selecione um tipo de público."
>
<f:selectItem itemLabel="Selecione um item..." itemValue=""/>
<f:selectItems value="#{publicoBean.lstMenuTipoPublico}"
var="atual"
itemLabel="#{atual.label}"
itemValue="#{atual}"></f:selectItems>
</p:selectOneMenu>
<p:commandButton value="Cancelar" immediate="true" onclick="dlgEditar.hide()"/>
<p:commandButton id="cbEditarSalvar" value="Salvar"
actionListener="#{publicoBean.alterarPublico}"
oncomplete="dlgEditar.hide();"
update=":frmPublicos:dtPublicos :frmEditar :frmPublicos:gMessages"/>
</p:panelGrid>
</p:panel>
</h:form>
</p:dialog>
</p:fieldset>
</f:view>
<!-- Javascript responsável por fechar a caixa de diálogo ao cadastrar-->
<script type="text/javascript">
function handleSalvo(xhr, status, args){
if(args.salvo){
dlgNovo.hide();
}
}
function handleEditar(xhr, status, args){
if(args.salvo){
dlgEditar.hide();
}
}
</script>
</ui:define>
Try p:resetInput. http://www.primefaces.org/showcase-labs/ui/resetInput.jsf
Try with pe:resetInput from Primefaces Extensions: http://fractalsoft.net/primeext-showcase-mojarra/sections/resetInput/formElements.jsf
<p:commandButton id="cbViewNovo"
value="Novo" type="button"
styleClass="cbViewNovo"
onclick="dlgNovo.show();"
update=":dlgNovoPublico"
process="#this">
<pe:resetInput target=":dlgNovoPublico"/>
</p:commandButton>

GET Parameter View Scoped Bean

I have a strange effect on my JSF2/richfaces 4 project. I use a viewscoped bean and a datascroller to view some data from my backing bean. The bean is viewscoped and to pass the figureId parameter I fire the preRenderView event.
<f:metadata>
<f:viewParam name="figureId" value="#{pointEdit.figureId}" >
<f:convertNumber pattern="###" />
</f:viewParam>
<f:event type="preRenderView" listener="#{pointEdit.init}" />
</f:metadata>
Displays fine, but when I click on the second site of the datascroller I get a nullponter exception for this line: <f:event type="preRenderView" listener="#{pointEdit.init}" />.
javax.el.ELException: /pointEdit.xhtml #17,66 listener="#{pointEdit.init}": java.lang.NullPointerException
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:111)
at com.sun.faces.facelets.tag.jsf.core.DeclarativeSystemEventListener.processEvent(EventHandler.java:128)
at javax.faces.component.UIComponent$ComponentSystemEventListenerAdapter.processEvent(UIComponent.java:2477)
at javax.faces.event.SystemEvent.processListener(SystemEvent.java:106)
at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2102)
at .....
Caused by: java.lang.NullPointerException
at com.ebcont.gtv.ePrometheus.web.backingbean.PointEdit.init(PointEdit.java:74) // <--first access to figure
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.el.parser.AstValue.invoke(AstValue.java:262)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
... 27 more
My Bean:
#ManagedBean
#ViewScoped
public class PointEdit implements Serializable {
public void init() {
FigureService figureService = Utils.getSpringBean(FigureService.class);
figure = figureService .getById(figureId); // figureId will NOT be passed from GET
pointListToDisplay = figure.getPoints(); // nullpointer :-(
Before I imported my new data it worked fine on my test figures.
Why is my figureId GET Parameter not found in the init function? With my testdata (5 figures) I never had a problem with this.
UPDATE:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<body>
<h:messages errorStyle="color:red" warnStyle="color:yellow" />
<rich:tabPanel switchType="client">
<rich:tab header="Punkte">
<rich:panel>
<f:facet name="header">
#{msg.pointEditDetail_figure_header }
</f:facet>
<div style="position: relative;">
<h:graphicImage url="/image?figureid=#{pointEdit.figure.id}"
style="border: solid 2px #013476;z-index: -2;">
<a4j:repeat value="#{pointEdit.points}" var="thepoi">
<h:panelGroup layout="block"
style="margin-top: -27px;top:#{thepoi.y}px; left: #{thepoi.x}px; background-image: url('images/poipin.png');background-repeat:none;width: 25px; height:27px; position:absolute; z-index: -0.9;display:none;"
styleClass="poi #{thepoi.id }">
<div style="margin-top: 27px;">
<a4j:repeat value="#{thepoi.labels}" var="poilabel">
<h:panelGroup layout="block"
styleClass="poilabel label#{thepoi.id}" style="display:none;">
<div style="color: white; z-index: 1; position: relative;">
<h:outputText value="#{poilabel.locale.isoCode}:"
style="background-image: url('images/layerbackground.png'); background-repeat: both;" />
<h:outputText value="#{poilabel.label.labelText}"
style="background-image: url('images/layerbackground.png'); background-repeat: both;"
rendered="#{not empty poilabel.label.labelText}" />
<h:outputText value="Nicht verfügbar"
style="background-image: url('images/layerbackground.png'); background-repeat: both;"
rendered="#{empty poilabel.label.labelText }" />
</div>
</h:panelGroup>
</a4j:repeat>
</div>
</h:panelGroup>
</a4j:repeat>
</h:graphicImage>
</div>
<br/>
<h:commandButton value="#{msg.pointEditDetail_show_all_button}"
onclick="$('.poi').toggle()"
rendered="#{ not empty pointEdit.points}" />
<h:button outcome="viewer.xhtml" value="#{msg.pointEditDetail_button_viewer}">
<f:param name="figureId" value="#{pointEdit.figure.id}"/>
<f:param name="zoom" value="1"/>
</h:button>
</rich:panel>
<br />
<rich:panel>
<f:facet name="header">
#{msg.pointEditDetail_points_header }
</f:facet>
<h:form>
<rich:dataTable value="#{pointEdit.points}" var="point"
id="pointtable" rows="10" rowKeyVar="rowId">
<rich:column>
<f:facet name="header">
#{msg.pointEditDetail_table_header_rowkey}
</f:facet>
#{rowId+1}
</rich:column>
<rich:column sortBy="#{point.id}" id="id"
sortOrder="#{pointEdit.pointIdOrder}">
<f:facet name="header">
<a4j:commandLink
value="#{msg.pointEditDetail_table_header_point} #{msg.pointEditDetail_table_header_id }"
render="pointtable" action="#{pointEdit.sortByPointId}" />
</f:facet>
#{point.id}
</rich:column>
<rich:column>
<f:facet name="header">
#{msg.pointEditDetail_table_header_x}
</f:facet>
#{point.x }
</rich:column>
<rich:column>
<f:facet name="header">
#{msg.pointEditDetail_table_header_y}
</f:facet>
#{point.y }
</rich:column>
<!-- filter (Object that extends Filter<?>), filterMethod, filterExpression -->
<rich:column filter="#{pointEdit.labelFilter}">
<f:facet name="header">
#{msg.pointEditDetail_table_header_label}
<h:inputText value="#{pointEdit.labelFilterText}">
<a4j:ajax event="change" render="pointtable" execute="#this" requestDelay="700"
ignoreDupResponses="true"/>
</h:inputText>
</f:facet>
<a4j:repeat var="pointlabel" value="#{point.labels}">
#{pointlabel.locale.isoCode}:
<h:outputText value="#{pointlabel.label.labelText}"
rendered="#{not empty pointlabel.label}" />
<h:outputText value="#{msg.pointEditDetail_not_available}"
rendered="#{empty pointlabel.label}" />
<br />
</a4j:repeat>
</rich:column>
<rich:column style="text-align:center">
<f:facet name="header">
#{msg.pointEditDetail_table_header_show_point}
</f:facet>
<h:selectBooleanCheckbox styleClass="pinchk#{point.id}"
value="false"
onchange="checkboxdrivendisplay(this,'.#{point.id }');checkboxdrivendisplay(this,'.lblchk#{point.id }');"
onmouseover="jQuery('.#{point.id }').show(); jQuery('.lblchk#{point.id }').show();"
onmouseout="checkboxdrivendisplay(this,'.#{point.id }');checkboxdrivendisplay(this,'.lblchk#{point.id }');">
</h:selectBooleanCheckbox>
</rich:column>
<rich:column style="text-align:center;">
<f:facet name="header">
#{msg.pointEditDetail_table_header_show_label}
</f:facet>
<h:selectBooleanCheckbox style="display:none"
styleClass="lblchk#{point.id}" value="false"
onclick="checkboxdrivendisplay(this,'.label#{point.id }');"
onmouseover="jQuery('.label#{point.id}').show();"
onmouseout="checkboxdrivendisplay(this,'.label#{point.id }');">
</h:selectBooleanCheckbox>
</rich:column>
<rich:column>
<f:facet name="header">
#{msg.pointEditDetail_table_header_edit_label }
</f:facet>
<center>
<h:link outcome="labelEdit.xhtml" value="#{msg.pointEditDetail_table_edit_label}">
<f:param name="pointId" value="#{point.id}"/>
</h:link>
</center>
</rich:column>
<rich:column>
<f:facet name="header">
#{msg.pointEditDetail_table_header_tag }
</f:facet>
<a4j:repeat var="tag" value="#{point.tags}" varStatus="index">
<h:link outcome="search.xhtml" value="#{tag.tag}">
<f:param name="tags" value="true" />
<f:param name="labels" value="false" />
<f:param name="legends" value="false" />
<f:param name="query" value="#{tag.tag}" />
</h:link>
</a4j:repeat>
</rich:column>
<rich:column>
<f:facet name="header">
#{msg.pointEditDetail_table_header_edit_tag }
</f:facet>
<center>
<h:link outcome="tagEdit.xhtml" value="#{msg.pointEditDetail_table_edit_tag}">
<f:param name="pointId" value="#{point.id}"/>
</h:link>
</center>
</rich:column>
<f:facet name="footer">
<rich:dataScroller for="pointtable" />
</f:facet>
</rich:dataTable>
</h:form>
</rich:panel>
</rich:tab>
<rich:tab header="Daten">
<h:form>
<rich:panel id="legendpanel">
<f:facet name="header">
#{msg.pointEditDetail_legend_edit_header }
</f:facet>
<h:outputText rendered="#{not empty pointEdit.legendeStatus}"
value="#{msg.pointEditDetail_legend_edit_success}" />
<br />
<h:inputTextarea value="#{pointEdit.legende}" cols="40" rows="8"/> <br /> <br />
<a4j:commandButton value="#{msg.pointEditDetail_legend_edit_button} "
render="legendpanel legende" action="#{pointEdit.editLegend}" />
</rich:panel>
</h:form>
<br />
<h:form>
<rich:panel name="labelPanel">
<f:facet name="header">
#{msg.pointEditDetail_label_edit_header }
</f:facet>
<rich:dataTable value="#{pointEdit.labels}" var="label"
id="labelTable" rows="10">
<rich:column>
<f:facet name="header">
Id
</f:facet>
#{label.id }
</rich:column>
<rich:column>
<f:facet name="header">
#{msg.pointEditDetail_label_edit_table_header}
</f:facet>
<rich:inplaceInput value="#{label.labelText }" showControls="true" layout="block" style="width: 98%"
required="true">
<a4j:ajax event="change" render="pointtable" listener="#{pointEdit.editLabel(label.id) }" />
</rich:inplaceInput>
</rich:column>
<f:facet name="footer">
<rich:dataScroller for="labelTable" />
</f:facet>
</rich:dataTable>
</rich:panel>
</h:form>
<br />
</rich:tab>
<rich:tab header="Verknüpfen">
<ui:include src="linkFigures.xhtml" />
</rich:tab>
</rich:tabPanel>
<script type="text/javascript" src="javascript/eprometheus.js"></script>
</body>
</html>
You need to either pass that parameter as <f:param> in the command link so that it retains in the subsequent request:
<h:commandLink>
<f:param name="figureId" value="#{pointEdit.figureId}" />
</h:commandLink>
or to check in the init() if FacesContext#isPostback() equals to false before proceeding (so that it only runs on a fresh new GET request, not in the subsequent postbacks as the bean is view scoped and the properties are already been set anyway):
public void init() {
if (!FacesContext.getCurrentInstance().isPostback()) {
// ...
}
}
My new test images where 5 times larger then the images i got 4 testing. In my ViewScoped bean i had the figure as property so the whole byte[] had to be serialized.
After removing this design flaw it works again and also explains why the new images cause troubles!

Dropdown's valueChangeListener not working with primefaces datatable

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?

Resources