I have two h:selectManyCheckBox with the required attribute set to true.
What I want is that the required attribute of both of the components work together.
Only display the error message if and only if both of the selected items list are empty.
Right now my problem is that the message displays if either one of them is empty. Here's my code:
<rich:panel>
<f:facet name="header">
<h:outputText value="Actualización de catálogos"/>
</f:facet>
<h:panelGrid columns="4">
<h:outputLabel for="actualizarCatalogoPEC"
value="Actualizar catálogos PEC"/>
<h:selectBooleanCheckbox id="actualizarCatalogoPEC"
value="#{administrationBean.actualizaTodosPecChecked}">
<f:ajax event="click"
render="todosCatalogosPEC"/>
</h:selectBooleanCheckbox>
<h:outputLabel for="actualizarCatalogoSAGARPA"
value="Actualizar catálogos SAGARPA"/>
<h:selectBooleanCheckbox id="actualizarCatalogoSAGARPA"
value="#{administrationBean.actualizaTodosSagarpaChecked}">
<f:ajax event="click"
render="todosCatalogosSAGARPA"/>
</h:selectBooleanCheckbox>
<a4j:outputPanel id="todosCatalogosPEC">
<h:selectManyCheckbox id="selectCatalogosPEC"
disabled="#{administrationBean.actualizaTodosPecChecked}"
required="true"
value="#{administrationBean.catalogosPecSeleccionados}"
requiredMessage="Seleccione al menos un catálogo"
layout="pageDirection">
<f:selectItems value="#{administrationBean.catalogosPecOptions}"/>
</h:selectManyCheckbox>
</a4j:outputPanel>
<h:panelGroup/>
<a4j:outputPanel id="todosCatalogosSAGARPA">
<h:selectManyCheckbox id="selectCatalogosSAGARPA"
disabled="#{administrationBean.actualizaTodosSagarpaChecked}"
required="true"
value="#{administrationBean.catalogosSagarpaSeleccionados}"
requiredMessage="Seleccione al menos un catálogo"
layout="pageDirection" >
<f:selectItems value="#{administrationBean.catalogosSagarpaOptions}"/>
</h:selectManyCheckbox>
</a4j:outputPanel>
<h:panelGroup/>
<rich:message id="messageCatalogosPEC"
for="selectCatalogosPEC"/>
<h:panelGroup/>
<rich:message id="messageCatalogosSAGARPA"
for="selectCatalogosSAGARPA"/>
<h:panelGroup/>
<a4j:commandButton value="Actualizar catálogos"
render="messageCatalogosPEC"
action="#{administrationBean.doActualizaCatalogos}"/>
</h:panelGrid>
</rich:panel>
Cheers
UPDATE
I've changed my code as follows: (just added binding and modified required)
<a4j:outputPanel id="todosCatalogosPEC">
<h:selectManyCheckbox id="selectCatalogosPEC"
disabled="#{administrationBean.actualizaTodosPecChecked}"
binding="selectCatalogosPEC"
required="#{empty selectCatalogosSAGARPA.value}"
value="#{administrationBean.catalogosPecSeleccionados}"
requiredMessage="Seleccione al menos un catálogo"
layout="pageDirection">
<f:selectItems value="#{administrationBean.catalogosPecOptions}"/>
</h:selectManyCheckbox>
</a4j:outputPanel>
<h:panelGroup/>
<a4j:outputPanel id="todosCatalogosSAGARPA">
<h:selectManyCheckbox id="selectCatalogosSAGARPA"
binding="selectCatalogosSAGARPA"
disabled="#{administrationBean.actualizaTodosSagarpaChecked}"
required="#{empty selectCatalogosPEC.value}"
value="#{administrationBean.catalogosSagarpaSeleccionados}"
requiredMessage="Seleccione al menos un catálogo"
layout="pageDirection" >
<f:selectItems value="#{administrationBean.catalogosSagarpaOptions}"/>
</h:selectManyCheckbox>
</a4j:outputPanel>
but got this error:
jun 01, 2012 10:31:37 AM org.apache.catalina.core.StandardWrapperValve invoke
Grave: Servlet.service() for servlet [Faces Servlet] in context with path [/SRC_RichFaces] threw exception [java.lang.String cannot be cast to javax.faces.component.UIComponent] with root cause
java.lang.ClassCastException: java.lang.String cannot be cast to javax.faces.component.UIComponent
at com.sun.faces.application.ApplicationImpl.createComponentApplyAnnotations(ApplicationImpl.java:1941)
at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:1144)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.createComponent(ComponentTagHandlerDelegateImpl.java:504)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:157)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at org.richfaces.view.facelets.html.BehaviorsAddingComponentHandlerWrapper.applyNextHandler(BehaviorsAddingComponentHandlerWrapper.java:53)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:184)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at org.richfaces.view.facelets.html.BehaviorsAddingComponentHandlerWrapper.applyNextHandler(BehaviorsAddingComponentHandlerWrapper.java:53)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:184)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at org.richfaces.view.facelets.html.BehaviorsAddingComponentHandlerWrapper.applyNextHandler(BehaviorsAddingComponentHandlerWrapper.java:53)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:184)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at org.richfaces.view.facelets.html.BehaviorsAddingComponentHandlerWrapper.applyNextHandler(BehaviorsAddingComponentHandlerWrapper.java:53)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:184)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at org.richfaces.view.facelets.html.BehaviorsAddingComponentHandlerWrapper.applyNextHandler(BehaviorsAddingComponentHandlerWrapper.java:53)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:184)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:152)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:774)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:317)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
You need to bind them both to the view and in the required attribute of the first one, check if the UIInput#getSubmittedValue() of the second one is empty and in the required attribute of the second one, check if the UIInput#getValue() of the first one is empty.
<h:selectManyCheckbox
binding="#{selectCatalogosPEC}"
required="#{empty selectCatalogosSAGARPA.submittedValue}"
>
...
</h:selectManyCheckbox>
<h:selectManyCheckbox
binding="#{selectCatalogosSAGARPA}"
required="#{empty selectCatalogosPEC.value}"
>
....
</h:selectManyCheckbox>
See also:
JSF two required h:inputText (exclusive or)
Related
<h:dataTable value="#{products.getAllProducts()}"
var="product">
....
<h:column rendered="...">
<f:facet name="header">Quantity</f:facet>
<h:inputText id="basket-qty" value="#{basket.qty}" rendered="#{product.stock.qty > 0}" >
<f:convertNumber integerOnly="true" />
<f:validateLongRange minimum="1" maximum="#{product.stock.qty}" />
</h:inputText>
<h:message id="textmessage" for="basket-qty" />
</h:column>
<h:column rendered="...">
<h:commandButton action="#{basket.addProduct(product)}"
value ="Add to Basket">
</h:commandButton>
</h:column>
</h:dataTable>
Basically the problem is that maximum="#{product.stock.qty}" is evaluating to zero, therefore my range is 0-0?
product.stock.qty evaluates correctly elsewhere in the table.
I have in my JSF 2 app on JBoss AS 7.1 a PrimeFaces 5.1 datatable with lazy loading and it sorts on page load, so I know my sorting implementation works, but when I click the column to sort it throws the below exception.
17:48:34,855 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/feenix].[Faces Servlet]] (http-/0:0:0:0:0:0:0:0:8080-6) JBWEB000236: Servlet.service() for servlet Faces Servlet threw exception:
java.lang.NullPointerException
at com.sun.faces.context.PartialViewContextImpl.createPartialResponseWriter(PartialViewContextImpl.java:469) [jsf-impl-2.1.28.redhat-3.jar:2.1.28.redhat-3]
at com.sun.faces.context.PartialViewContextImpl.access$300(PartialViewContextImpl.java:76) [jsf-impl-2.1.28.redhat-3.jar:2.1.28.redhat-3]
at com.sun.faces.context.PartialViewContextImpl$DelayedInitPartialResponseWriter.getWrapped(PartialViewContextImpl.java:603) [jsf-impl-2.1.28.redhat-3.jar:2.1.28.redhat-3]
at javax.faces.context.PartialResponseWriter.startDocument(PartialResponseWriter.java:115) [jboss-jsf-api_2.1_spec-2.1.28.Final-redhat-1.jar:2.1.28.Final-redhat-1]
at org.primefaces.context.PrimePartialResponseWriter.startDocument(PrimePartialResponseWriter.java:152) [primefaces-5.1.jar:5.1]
at com.sun.faces.context.AjaxExceptionHandlerImpl.handlePartialResponseError(AjaxExceptionHandlerImpl.java:201) [jsf-impl-2.1.28.redhat-3.jar:2.1.28.redhat-3]
at com.sun.faces.context.AjaxExceptionHandlerImpl.handle(AjaxExceptionHandlerImpl.java:126) [jsf-impl-2.1.28.redhat-3.jar:2.1.28.redhat-3]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119) [jsf-impl-2.1.28.redhat-3.jar:2.1.28.redhat-3]
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116) [jsf-impl-2.1.28.redhat-3.jar:2.1.28.redhat-3]
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.28.redhat-3.jar:2.1.28.redhat-3]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [jboss-jsf-api_2.1_spec-2.1.28.Final-redhat-1.jar:2.1.28.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]
My data table:
<p:dataTable var="registroD" value="#{reportes.diario}" paginator="true" rows="10" rowsPerPageTemplate="10,20,40,80" id="registroDiarioTable" lazy="true"
paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}">
<p:column headerText="Fecha">
<h:outputText value="#{registroD.fechaRegistro}">
<f:convertDateTime pattern="yyyy/MM/dd" type="date"/>
</h:outputText>
</p:column>
<p:column headerText="Nombre Asesor" sortBy="#{registroD.idTrabajo.idUsuario.nombres}" filterBy="#{registroD.idTrabajo.idUsuario.nombres}">
<h:outputText value="#{registroD.idTrabajo.idUsuario.nombres}"/>
</p:column>
<p:column headerText="Apellido Asesor" sortBy="#{registroD.idTrabajo.idUsuario.apellidos}" filterBy="#{registroD.idTrabajo.idUsuario.apellidos}">
<h:outputText value="#{registroD.idTrabajo.idUsuario.apellidos}"/>
</p:column>
<p:column headerText="Lugar entrega" sortBy="#{registroD.idTrabajo.idUbicacion.direccion}" filterBy="#{registroD.idTrabajo.idUbicacion.direccion}">
<h:outputText value="#{registroD.idTrabajo.idUbicacion.direccion}"/>
</p:column>
<p:column headerText="Hora entrega">
<h:outputText value="#{registroD.fechaRegistro}">
<f:convertDateTime pattern="HH:mm:ss" type="time"/>
</h:outputText>
</p:column>
<p:column headerText="Nombre" sortBy="#{registroD.numero.nombres}" filterBy="#{registroD.numero.nombres}">
<h:outputText value="#{registroD.numero.nombres}"/>
</p:column>
<p:column headerText="Apellido" sortBy="#{registroD.numero.apellidos}" filterBy="#{registroD.numero.apellidos}">
<h:outputText value="#{registroD.numero.nombres}"/>
</p:column>
<p:column headerText="Numero Celular" sortBy="#{registroD.numero.numero}" filterBy="#{registroD.numero.numero}">
<h:outputText value="#{registroD.numero.numero}" />
</p:column>
<p:column headerText="Producto" sortBy="#{registroD.producto}" filterBy="#{registroD.producto}">
<h:outputText value="#{registroD.producto}"/>
</p:column>
</p:dataTable>
This error has nothing to do (seems to me that way) with the actions I do.
What is going on?
The stack trace tells that this exception occurred while handling an exception during restore view phase of an ajax request. This is a second problem which has unfortunately hidden away all detail about the underlying exception which JSF was trying to handle, so this question can't be answered by just looking at the stack trace until you fix/replace the standard exception handler.
If upgrading to latest Mojarra version doesn't solve it, then you can (temporarily) use the one shown in this answer to print the stack trace of the real underlying exception: Exception handling in JSF ajax requests. That should in turn give sufficient clues about the real underlying problem.
I want to update one component from another inside p:overlayPanel inside p:datatable
here is the code :
<p:tabView id="monpanel">
<p:tab id="tab1" title=".....">
.....
</p:tab>
<p:tab id="tab2" title=".....">
.....
</p:tab>
<p:tab id="tab3" title="Stock et fournisseurs">
<h:panelGrid>
<h:outputLabel value="Stock : "
style="text-decoration: underline;font-weight: 900;" />
<p:commandButton id="carBtn" value="Ajouter" type="button" />
<p:outputLabel id="nombref"
value="#{articlesMB.NBF} fournisseurs séléctionnés." />
<p:overlayPanel appendToBody="true" widgetVar="overlayp"
id="carPanel" for="carBtn" hideEffect="fade" dynamic="true">
<p:dataTable id="table" var="car" rowKey="#{car.fournisseurId}"
value="#{articlesMB.listfournisseurs}"
selection="#{articlesMB.selectedFournisseurs}" rows="10"
paginator="true">
<p:column selectionMode="multiple" style="width:20px" />
<p:column headerText="Id">
<h:outputText value="#{car.fournisseurId}" />
</p:column>
<p:column headerText="Nom">
<h:outputText value="#{car.personne.nom}" />
</p:column>
<f:facet name="footer">
<p:commandButton id="multiViewButton" value="View"
icon="ui-icon-search" update=":nombref"
oncomplete="multiCarDialog.show()" />
</f:facet>
</p:dataTable>
</p:overlayPanel>
</p:tab>
<p:tabview>
I tested update=":nombref" and update="monpanel:nombref" and update=":monpanel:nombref" but always I have this error :
com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback visit
GRAVE: javax.faces.FacesException: Cannot find component with identifier ":nombref" referenced from "monpanel:table:multiViewButton".
How can I fix this error?
I am getting below exception during ajax call on selectOneRadio button change.
I am using primefaces 3.3.1 and JSF 2.0
Exception:
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1937)
at com.sun.faces.renderkit.ServerSideStateHelper.getState(ServerSideStateHelper.java:263)
at com.sun.faces.renderkit.ResponseStateManagerImpl.getState(ResponseStateManagerImpl.java:97)
at com.sun.faces.application.view.StateManagementStrategyImpl.restoreView(StateManagementStrategyImpl.java:217)
at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:177)
at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:119)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:438)
at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:144)
at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:182)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:107)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)
My code is as below:
<h:panelGrid columns="3" style="align:center">
<h:outputText value="#{msg.accountCategory}" />
<p:spacer width="10px" />
<p:selectOneRadio id="singleJointAccountRadioId"
layout="horizontal"
value="#{captureAccountDetailBackingBean.accountCategory}">
<f:selectItems
value="#{captureAccountDetailBackingBean.accountcategoryList}">
</f:selectItems>
<p:ajax process="#this" update="secondAccountId" />
</p:selectOneRadio>
</h:panelGrid>
<h:panelGroup id="secondAccountId">
<h:panelGrid id="secondAccountHolderId" columns="2"
styleClass="float-left"
rendered="#{captureAccountDetailBackingBean.accountCategory eq 'Joint'}">
<p:graphicImage
value="/com/cas/pages/common/images/person_icon.jpg" />
<h:outputText value="#{msg.secondAccountHolder}" />
<h:panelGrid columns="2">
<h:outputText value="#{msg.nameofPerson}"
style="font-size:15px;" />
<span style="color: red;">*</span>
</h:panelGrid>
<p:inputText
value="#{captureAccountDetailBackingBean.accountHolder2.personName}"
styleClass="inputText-style" size="25" required="true" />
<h:panelGrid columns="2">
<p:selectOneRadio id="fatherHusbandRadioButtonId2"
layout="horizontal"
value="#{captureAccountDetailBackingBean.accountHolder2.personHusbandOrFatherID}">
<f:selectItems
value="#{captureAccountDetailBackingBean.holderRelationList}"></f:selectItems>
</p:selectOneRadio>
<span style="color: red;">*</span>
</h:panelGrid>
<p:inputText
value="#{captureAccountDetailBackingBean.accountHolder2.relativeName}"
styleClass="inputText-style" size="25" required="true" />
<h:panelGrid columns="2">
<h:outputText value="#{msg.address}" />
<span style="color: red;">*</span>
</h:panelGrid>
<p:inputTextarea
value="#{captureAccountDetailBackingBean.accountHolder2.personAddress}"
rows="3" autoResize="false" styleClass="inputText-style"
size="25" required="true" />
<h:panelGrid columns="2">
<h:outputText value="#{msg.dateOfBirth}" />
<span style="color: red;">*</span>
</h:panelGrid>
<p:calendar
value="#{captureAccountDetailBackingBean.accountHolder2.personDOB}"
navigator="true" showOn="button" size="6"
styleClass="inputText-style" required="true" />
<h:panelGrid columns="2">
<h:outputText value="#{msg.age}" />
<span style="color: red;">*</span>
</h:panelGrid>
<p:inputText
value="#{captureAccountDetailBackingBean.accountHolder2.personAge}"
size="2" styleClass="inputText-style" required="true" />
<h:panelGrid columns="2">
<h:outputText value="#{msg.pancardNumber}" />
<span style="color: red;">*</span>
</h:panelGrid>
<p:inputText
value="#{captureAccountDetailBackingBean.accountHolder2.personPanNo}"
size="15" styleClass="inputText-style" required="true" />
<h:panelGrid columns="2">
<h:outputText value="#{msg.mobileNumber}" />
<span style="color: red;">*</span>
</h:panelGrid>
<p:inputText
value="#{captureAccountDetailBackingBean.accountHolder2.personMobileNo}"
size="15" styleClass="inputText-style" required="true" />
</h:panelGrid>
</h:panelGroup>
i have a dynamic form based on dataTable, nested inside another dataTable.
on selecting a row from nested dataTable i'd like to update corresponding row from parent dataTable using <p:ajax>
<h:form id="form">
<h:dataTable var="field" value="#{testBean.propertyList}" varStatus="status">
<h:column>
<h:outputLabel value="#{field.label}"/>
</h:column>
<h:column>
<h:panelGrid columns="2" styleClass="app-grid" rendered="#{field.toOne}">
<h:panelGroup id="value">
<h:outputText value="#{testBean.entity[field.name]}"/>
</h:panelGroup>
<h:panelGroup>
<p:commandButton id="button" type="button" icon="ui-icon ui-icon-search"/>
<p:overlayPanel for="button" my="left bottom" at="left bottom" widgetVar="panel_#{field.name}">
<p:dataTable
id="table"
value="#{field.selectableModel}"
selection="#{testBean.entity[field.name]}"
selectionMode="single"
var="item"
rows="10"
paginator="true"
paginatorAlwaysVisible="true"
paginatorPosition="bottom"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
currentPageReportTemplate="{totalRecords} records found"
rowsPerPageTemplate="5,10,15">
<p:ajax event="rowSelect" update=":???:value" oncomplete="panel_#{field.name}.hide()"/>
<p:column headerText="entity">#{item}</p:column>
</p:dataTable>
</p:overlayPanel>
</h:panelGroup>
</h:panelGrid>
</h:column>
</h:dataTable>
</h:form>
the problem is that generated component tree does not have repeated explicit child components for dataTable:
<HtmlForm enctype="application/x-www-form-urlencoded" id="form" inView="true" prependId="true" rendered="true" submitted="false" transient="false">
<HtmlDataTable border="-2147483648" first="0" id="j_idt101" inView="true" rendered="true" rowIndex="-1" rowStatePreserved="false" rows="0" transient="false" var="field">
<UIColumn id="j_idt103" inView="true" rendered="true" transient="false">
<HtmlOutputLabel escape="true" id="j_idt120" inView="true" rendered="true" style="" transient="false"/>
</UIColumn>
<UIColumn id="j_idt121" inView="true" rendered="true" transient="false">
<HtmlPanelGrid border="-2147483648" columns="2" id="j_idt122" inView="true" rendered="false" styleClass="app-grid" transient="false">
<HtmlPanelGroup id="value" inView="true" rendered="true" transient="false">
<HtmlOutputText escape="true" id="j_idt227" inView="true" rendered="true" transient="false"/>
</HtmlPanelGroup>
<HtmlPanelGroup id="j_idt117" inView="true" rendered="true" transient="false">
<CommandButton ajax="true" async="false" disabled="false" escape="true" global="true" icon="ui-icon ui-icon-search" iconPos="left" id="button" immediate="false" inView="true" inline="false" partialSubmit="true" readonly="false" rendered="true" transient="false" type="button"/>
<OverlayPanel appendToBody="false" at="left bottom" dynamic="false" for="button" id="j_idt228" inView="true" my="left bottom" rendered="true" transient="false" widgetVar="panel_">
<DataTable currentPageReportTemplate="{totalRecords} records found" draggableColumns="false" editable="false" emptyMessage="No records found." filterEvent="keyup" first="0" id="table" inView="true" lazy="false" liveScroll="false" pageLinks="10" paginator="true" paginatorAlwaysVisible="true" paginatorPosition="bottom" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rendered="true" resizableColumns="false" rowIndex="-1" rowStatePreserved="false" rows="10" rowsPerPageTemplate="5,10,15" scrollHeight="-2147483648" scrollRows="0" scrollWidth="-2147483648" scrollable="false" selectionMode="single" sortOrder="ascending" transient="false" var="item">
<Column colspan="1" disabledSelection="false" filterBy="false" filterMatchMode="startsWith" filterMaxLength="2147483647" filterPosition="bottom" headerText="entity" id="j_idt229" inView="true" rendered="true" resizable="true" rowspan="1" transient="false" width="-1">
#{item}
</Column>
</DataTable>
</OverlayPanel>
</HtmlPanelGroup>
</HtmlPanelGrid>
</UIColumn>
</HtmlDataTable>
</HtmlForm>
for this reason i'm thinking about using <c:forEach> instead of parent dataTable to make every row explicit in component tree.
but the first problem is that testBean is #ViewScoped...
and the second is that using <c:forEach> causes a Java Heap Space error...
some hint?
Give the outer table a fixed id.
<h:dataTable id="table" ...>
Then you'll be able to use
<p:ajax ... update=":form:table:value" />