InputText never updates backing bean

UI Components for JSF
Post Reply
maipucino
Posts: 112
Joined: 19 Apr 2010, 22:04

30 Jun 2011, 14:52

Hi,

I am having some issues with 3.0.M2-SNAPSHOT and this form. The problem is that backing bean is never updated, so when I change some value on screen and press the commandButton to save that changes, selectedAccount (backin bean) never gets updated and new values never reach the database.

I was playing with commandButton's process attribute but it is not clear to me what is happening.

Any advice?. I searched the forum but couldn't find useful answers.

Thanks in advance!

Code: Select all

<?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:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.prime.com.tr/ui" 
                template="../../layout/template.xhtml">

		<ui:param name="portalName" value="ADMINISTRACIÓN" />
		<ui:param name="leftTitle" value="Selector de Cuentas" />
		<ui:param name="centerTitle" value="Detalles de la Cuenta" />

		<ui:define name="left">
				<h:form id="leftForm">
						<f:view>
								<p:dataTable var="account" 
											 value="#{accountController.accountList}"
											 id="accountsTable"
											 selection="#{accountController.selectedAccount}"
											 selectionMode="single" 
											 emptyMessage="No hay datos"
											 >

										<p:ajax event="rowSelect" listener="#{accountController.handleSelect}" update=":accountForm:accountGrid"  />
										<p:ajax event="rowUnselect" listener="#{accountController.handleUnselect}" update=":accountForm:accountGrid" />

										<p:column headerText="ID#" 
												  filterBy="#{account.accountId}"
												  filterMatchMode="contains"
												  style="text-align: right">
												<h:outputText value="#{account.accountId}"/>
										</p:column>

										<p:column headerText="Denominación"
												  filterBy="#{account.accountName}"
												  filterMatchMode="contains">
												<h:outputText value="#{account.accountName}"/>
										</p:column>

								</p:dataTable>
						</f:view>
				</h:form>
		</ui:define>

		<ui:define name="content">
				<f:view>
						<p:tabView>
								<p:tab title="Detalles">
										<h:form id="accountForm" >
												<h:panelGrid id="grid1" columns="1" >
														<h:panelGrid id="accountGrid" 
																	 columns="2" 
																	 style="margin-bottom:5px" 
																	 cellpadding="5"
																	 >
																<h:outputText value="Id"/>
																<p:inputText value="#{accountController.selectedAccount.accountId}"
																			 readonly="true" />

																<h:outputText value="Denominación"/>
																<p:inputText value="#{accountController.selectedAccount.accountName}" size="70"
																			 id="accountNameFld"
																			 maxlength="128"
																			 required="true"
																			 requiredMessage="Debe ingresar la Denominación de la Cuenta"
																			 />

																<h:outputText value="Tipo"/>
																<p:selectOneMenu value="#{accountController.selectedAccount.accountType}"
																				 converter="#{accountTypeConverter}" 
																				 effect="fade" 
																				 style="width:100%; height:25px"
																				 required="true">
																		<f:selectItems value="#{accountTypeController.accountTypeList}"
																					   var="type"
																					   itemLabel="#{type.accountTypeName}" 
																					   itemValue="#{type}" />
																</p:selectOneMenu>

																<h:outputText value="Moneda"/>
																<p:selectOneMenu value="#{accountController.selectedAccount.currency}"
																				 converter="#{currencyConverter}" 
																				 effect="fade" 
																				 style="width:100%; height:25px"
																				 required="true">
																		<f:selectItems value="#{currencyController.currencyList}"
																					   var="currency"
																					   itemLabel="#{currency.currencyName}" 
																					   itemValue="#{currency}" />
																</p:selectOneMenu>

																<h:outputText value="Habilitada"/>
																<p:selectBooleanCheckbox value="#{accountController.selectedAccount.enabled}"/>

																<h:outputText value="Instrucciones"/>
																<p:inputTextarea value="#{accountController.selectedAccount.instructions}"
																				 autoResize="true" 
																				 cols="50"/>
														</h:panelGrid>
														<p:commandButton value="Grabar" 
																		 actionListener="#{accountController.updateSelectedAccount}"
																		 update=":leftForm:accountsTable"
																		 image="ui-icon ui-icon-disk"
																		 process="@this, :accountForm:accountGrid"
																		 />
												</h:panelGrid>
										</h:form>
								</p:tab>
								<p:tab title="Ficha" >
								</p:tab>
								<p:tab title="Novedades" >
								</p:tab>
								<p:tab title="Contactos" >
								</p:tab>
						</p:tabView>
				</f:view>
		</ui:define>
</ui:composition>



tonico
Posts: 51
Joined: 22 Aug 2010, 00:15

30 Jun 2011, 18:09

A quick suggestion at first:

1) Install the Firefox plugin named "Firebug"
2) Initiate firebug and load your application, set firebug on "Console" mode and click on "persist"
3) Perform you action , then look on the transaction at the firebug console and see what data comes out of "post". See if your data is in there
4) Then, observe the "response" in XML form and see if there is a "validationFailed = true" somewhere in the end of the response. If so, you'd better add a <p:messages /> tag in your page so you will receive such validation messages for your awareness.
- Tonico
Primefaces 2.2.1 - Glassfish 3.1 - Mac OS X Lion

maipucino
Posts: 112
Joined: 19 Apr 2010, 22:04

07 Jul 2011, 00:57

Hi,
thanks for the advice.

Using Firebug help me solve my issue. I had several validations problems.

Regards,
Diego.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 50 guests