[jboss-user] [JBoss Seam] - Re: selectItems+ajax4jsf

gllambi do-not-reply at jboss.com
Thu Dec 28 11:17:07 EST 2006


"atzbert" wrote : Are there any news here? I experienced this issue now twice, with ajax4jsf and icefaces... :(

After some work, I found a solution to the problem. It isn't from the selectItem tag. It is a problem of using ajax4jsf with jsf and seam together.

To make it work you must use the region and page ajax4jsf's tags. 

The tag page must go after the jsf view tag. This is due a problem of ajax4jsf and myfaces. More explanation of this is found in the ajax4jsf page. 

Then put the combo between the region tag. If you want to refresh something outside of the region, you have to set the option renderRegionOnly to false

Here is the code that worked for me.


  | <f:view>
  | <a4j:page>
  | 		<h:outputText id="titulo" value="#{msg.titulo_registro}" />
  | 		<h:form id="formRegistro">
  | 			<a4j:outputPanel id="mensajesErrorPanel" styleClass="error">
  | 				<div><h:messages id="mensajesError" /></div>
  | 			</a4j:outputPanel>
  | 			<s:validateAll>
  | 				<h:panelGrid id="panelGrid" columns="2">
  | 					<h:outputText id="etiquetaUsuario" value="#{msg.socio}" />
  | 					<a4j:region id="regionUsuario">
  | 						<s:decorate>
  | 							<h:inputText id="inputUsuario" value="#{cliente.usuario}"
  | 								size="30" required="true">
  | 								<a4j:support id="soporteAjaxUsuario" event="onblur"
  | 									reRender="errorUsuario" />
  | 							</h:inputText>
  | 							<a4j:outputPanel id="errorUsuario" styleClass="error">
  | 								<s:message id="mensajeErrorUsuario" />
  | 							</a4j:outputPanel>
  | 						</s:decorate>
  | 					</a4j:region>
  | 					<h:outputText id="etiquetaContraseña" value="#{msg.contraseña}" />
  | 					<a4j:region id="regionContraseña">
  | 						<s:decorate>
  | 							<h:inputText id="inputContraseña" value="#{cliente.pwd}"
  | 								size="30" required="true">
  | 								<a4j:support id="soporteAjaxContraseña" event="onblur"
  | 									reRender="errorPassword" />
  | 							</h:inputText>
  | 							<a4j:outputPanel id="errorPassword" styleClass="error">
  | 								<s:message id="mensajeErrorContraseña" />
  | 							</a4j:outputPanel>
  | 						</s:decorate>
  | 					</a4j:region>
  | 					<h:outputText id="etiquetaPais" value="#{msg.pais}" />
  | 					<a4j:region id="regionPaises" renderRegionOnly="false">
  | 						<s:decorate>
  | 							<h:selectOneMenu id="seleccionarPais"
  | 								converter="#{registro.countryConverter}" required="true"
  | 								value="#{cliente.country}">
  | 								<si:selectItems value="#{paises}" var="pais"
  | 									label="#{pais.countryCode}"
  | 									noSelectionLabel="#{msg.selecionePais}" hideNoSelection="true"></si:selectItems>
  | 								<a4j:outputPanel id="errorPais" styleClass="error">
  | 									<s:message id="mensajeErrorPais" />
  | 								</a4j:outputPanel>
  | 								<a4j:support id="soporteAjaxPais" event="onchange"
  | 									reRender="seleccionarEstado, mensajeErrorPais"
  | 									action="#{registro.cambiarEstados}" />
  | 							</h:selectOneMenu>
  | 						</s:decorate>
  | 					</a4j:region>
  | 					<h:outputText id="etiquetaEstado" value="#{msg.estado}" />
  | 					<a4j:region id="regionEstados">
  | 							<h:selectOneMenu id="seleccionarEstado"
  | 								converter="#{registro.stateConverter}" value="#{cliente.state}">
  | 								<si:selectItems value="#{estados}" var="estado"
  | 									label="#{estado.stateCode}"
  | 									noSelectionLabel="#{msg.seleccioneEstado}"
  | 									hideNoSelection="true"></si:selectItems>
  | 							</h:selectOneMenu>
  | 					</a4j:region>
  | 				</h:panelGrid>
  | 				<a4j:commandButton id="botonAjax" value="Ajax #{msg.registrarse}"
  | 					action="#{registro.registrarse}"
  | 					reRender="formRegistro:mensajesErrorPanel"></a4j:commandButton>
  | 			</s:validateAll>
  | 		</h:form>
  | 		</a4j:page>
  | </f:view>
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3996665#3996665

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3996665




More information about the jboss-user mailing list