<SOLVED>allowTextChildren and form issue.

UI Components for JSF
Post Reply
g4alliance
Posts: 22
Joined: 02 Feb 2010, 00:24

03 Mar 2010, 03:11

Going insane on this problem, hopefully it's something simple that I'm just missing.

Ok. I switched to Primefaces 2.0 from the 2.0RC and I'm using Mojarra 2.0.2, Glassfish V3 and Netbeans 6.8

Everything worked fine until the switch.
Now I went through and changed the few items that did change (partialsubmit gone etc).

That worked partly (some things did not update when submitted with ajax).
Re-Read the configuration install and I saw I needed to put in allowTextChildren.

The problem is when I put in allowTextChildren it causes most of the page to fail to render.

I get the following error from glassfish.

Code: Select all

SEVERE: Error Rendering View[/users/workingNEW.xhtml]
java.lang.NullPointerException
        at javax.faces.component.UIComponentBase.findComponent(UIComponentBase.java:564)
        at org.primefaces.component.message.MessageRenderer.encodeEnd(MessageRenderer.java:35)
        at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:878)
        at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:295)
        at com.sun.faces.renderkit.html_basic.TextRenderer.encodeChildren(TextRenderer.java:203)
        at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)
        at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:287)
        at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:185)
        at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:129)
        at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)
        at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1613)
        at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
        at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)
        at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:66)
        at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:54)
        at org.primefaces.component.panel.PanelRenderer.encodeContent(PanelRenderer.java:119)
        at org.primefaces.component.panel.PanelRenderer.encodeMarkup(PanelRenderer.java:73)
        at org.primefaces.component.panel.PanelRenderer.encodeEnd(PanelRenderer.java:39)
        at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:878)
        at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:70)
        at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:54)
        at org.primefaces.component.tabview.TabViewRenderer.encodeContents(TabViewRenderer.java:198)
        at org.primefaces.component.tabview.TabViewRenderer.encodeMarkup(TabViewRenderer.java:130)
        at org.primefaces.component.tabview.TabViewRenderer.encodeEnd(TabViewRenderer.java:48)
        at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:878)
        at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1620)
        at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)
        at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)
        at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:380)
        at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:126)
        at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:127)
        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:313)
        at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
        at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
        at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
        at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
        at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
        at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
        at java.lang.Thread.run(Thread.java:619)
My Web.xml is

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!--
Will this comment fubar the deployment??
-->
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <display-name>OhioOnlineBilling</display-name>
    <context-param>
        <param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Production</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>server</param-value>
    </context-param>
    <context-param>
        <param-name>com.sun.faces.allowTextChildren</param-name>
        <param-value>true</param-value>
    </context-param>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <servlet>
        <servlet-name>Resource Servlet</servlet-name>
        <servlet-class>org.primefaces.resource.ResourceServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Resource Servlet</servlet-name>
        <url-pattern>/primefaces_resource/*</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>15</session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>login.jsp</welcome-file>
    </welcome-file-list>
    <security-constraint>
        <display-name>Admin Folder Constraint</display-name>
        <web-resource-collection>
            <web-resource-name>ADMIN_FOLDER</web-resource-name>
            <description>Admin Folder</description>
            <url-pattern>/faces/admin/*</url-pattern>
            <url-pattern>/admin/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <description/>
            <role-name>ADMIN</role-name>
        </auth-constraint>
        <user-data-constraint>
            <description/>
            <transport-guarantee>CONFIDENTIAL</transport-guarantee>
        </user-data-constraint>
    </security-constraint>
    <security-constraint>
        <display-name>Clinician Folder Constraint</display-name>
        <web-resource-collection>
            <web-resource-name>CLINICIAN_FOLDER</web-resource-name>
            <description>Clinician Folder</description>
            <url-pattern>/faces/users/*</url-pattern>
            <url-pattern>/users/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <description/>
            <role-name>CLINICIAN</role-name>
            <role-name>ADMIN</role-name>
        </auth-constraint>
        <user-data-constraint>
            <description/>
            <transport-guarantee>CONFIDENTIAL</transport-guarantee>
        </user-data-constraint>
    </security-constraint>
    <security-constraint>
        <display-name>HTTPSALL</display-name>
        <web-resource-collection>
            <web-resource-name>HTTPSALL</web-resource-name>
            <description>HTTPSALL</description>
            <url-pattern>/*</url-pattern>
        </web-resource-collection>
        <user-data-constraint>
            <description/>
            <transport-guarantee>CONFIDENTIAL</transport-guarantee>
        </user-data-constraint>
    </security-constraint>
    <login-config>
        <auth-method>FORM</auth-method>
        <realm-name>OnlineBillingSecurityRealm</realm-name>
        <form-login-config>
            <form-login-page>/faces/login.jsp</form-login-page>
            <form-error-page>/faces/LoginError.xhtml</form-error-page>
        </form-login-config>
    </login-config>
    <security-role>
        <description/>
        <role-name>CLINICIAN</role-name>
    </security-role>
    <security-role>
        <description/>
        <role-name>ADMIN</role-name>
    </security-role>
    
</web-app>
And the page in question (well the first half of it at least...it's huge).
It doesn't render anything AFTER the very first form.
Anything enclosed in that form gets rendered but nothing after.
I've tried enclosing the entire first panelGrid in a single form and it renders that.....but stops afterwards.
This has been driving me crazy for 2 days now *sigh*

Code: Select all

<?xml version="1.0"   encoding="UTF-8" ?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      >
    <f:metadata >
        <f:event type="preRenderView"  listener="#{MyWebSession.verifyUserServices()}" />
    </f:metadata>

    <f:view  contentType="text/html" >
        <h:head>

                <h:outputScript name="../JS/date-en-US.js"/>
            <h:outputScript name="../JS/compressedCustomJS.js"/>
            <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/yui/2.8.0r4/build/yahoo/yahoo-min.js"></script>
            <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/yui/2.8.0r4/build/event/event-min.js"></script>
            <script type="text/javascript" >

                var thePageVar='WORKING';
                doNewSetup();
                var wasCCSetupDone=true;
                var selectedAddService=-1;
                var selectedEditService=-1;
                var addServiceFormRendered='true';

                   var theServiceTypes = new ServiceType();

                var variableFromServer = '${MyWebSession.myServiceTypeString}';
    
                theServiceTypes=setupServiceTypes(variableFromServer);
           function setTheServTypesFromId(){
            variableFromServer = document.getElementById('serviceTypeDiv').value;
            theServiceTypes=setupServiceTypes(variableFromServer);
           }
            </script>

            <title>Service</title>
            <meta content='text/html; charset=UTF-8'  http-equiv='Content-Type'/>
            <meta http-equiv="Cache-Control" content="no-store"/>
            <meta name="copyright" content="© 2010 Greg Cook" />
            <meta http-equiv="content-language" content="en" />
            <meta name="robots" content="noindex,nofollow" />
            <meta name="googlebot" content="nosnippet,nofollow" />
            <meta name="google" content="notranslate"/>
            <meta http-equiv="Pragma" content="no-cache"/>
            <meta http-equiv="Expires" content="-1"/>

        </h:head>
        <h:body   >
            <p:idleMonitor timeout="600000" onidle="alert('You have been logged out due to inactivity');goLogoutPage();" />

            <p:layout  fullPage="true"  >
                <p:layoutUnit   position="north" resizable="false"  rendered="false"  size="65" >
                    <h:panelGrid columns="2" id="hpanel1" >
                    </h:panelGrid>
                </p:layoutUnit>
                <p:layoutUnit position="south" rendered="false" size="30">
                </p:layoutUnit>
                <p:layoutUnit position="west" rendered="false">
                </p:layoutUnit>
                <p:layoutUnit position="east" closed="true"  rendered="false" size="0">

                </p:layoutUnit>

                <p:layoutUnit   position="center"      >

                    <h:panelGrid   columns="3" width="100%"  id="hpanel2"  frame="box" style="vertical-align: middle;text-align: center;" >
                        <h:form>
                            <div   style="vertical-align: middle;text-align: center;margin: 10px;">
                                <h:commandButton style="vertical-align: middle;text-align: center;"
                                                 type="submit"
                                                 id="doLogout"
                                                 action="#{MyWebSession.logout}"
                                                 value="Logout" />
                            </div>
                        </h:form>
                        <h:outputLabel value="My Test System"
                                       style="vertical-align: middle;text-align: center;margin: 10px;" />

                        <h:panelGroup>
                            <h:form id="clientChangeForm" prependId="false" >
                                <div   style="vertical-align: middle;text-align: center;margin: 10px;">
                                    <h:outputLabel value="School Selected: "  for="myClientSelectMenu"
                                                   style="vertical-align: middle;text-align: center;" >

                                        <h:selectOneMenu  tabindex="0"   label="School" value="#{MyWebSession.clientIndexSelected}"
                                                          id="myClientSelectMenu"
                                                          style="vertical-align: middle;text-align: center;" >
                                            <p:ajax event="change" actionListener="#{MyWebSession.doClientChange}"  oncomplete="setTimeout('doSetTabsTimeout()',1000);setTheServTypesFromId();"
                                                    update="mainAlert,growl,serviceTypeDiv,overallTabView"
                                                    process="myClientSelectMenu"
                                                    />
                                            <f:selectItems value="#{MyWebSession.clientSelectsList}"     />
                                        </h:selectOneMenu>
                                    </h:outputLabel>
                                    <h:inputHidden id="serviceTypeDiv"  value="#{MyWebSession.myServiceTypeString}" />
                                  
                                </div>
                            </h:form>
                        </h:panelGroup>
                    </h:panelGrid>
                    <h:outputText value="Logged In As: #{MyWebSession.currentUser.displayName}" style="font: 75%;color: blue" />
                    <h:outputLink  rendered="#{MyWebSession.isAdmin}" value="/OhioOnlineBilling/faces/admin/admin.xhtml"  >Admin Area</h:outputLink>
                    <center>
                        <h:outputText id="mainAlert" style="font-size: x-large; font-weight: bold ;text-decoration:underline; color: #{loginPageBean.primaryAlert.alertcolor};text-align: center;text-decoration:blink" value="#{loginPageBean.primaryAlert.thealert}"  />

                    </center>

                    <p:tabView id="overallTabView"     orientation="top"    widgetVar="theOverallTV" >
                        <p:tab    id="caseloadListTab" title="Caseload"     >
                            <p:panel  header="" toggleable="false"  widgetVar="caseloadPanel"  id="caseloadPanelID" >
                                <h:form id="filterStudentTableForm" prependId="false">
                                    <h:panelGrid  columns="6" frame="box" >
                                        <h:outputText value="Last Name"/>  <h:inputText  value="#{MyWebSession.searchLastName}"/>
                                        <h:outputText value="First Name"/>  <h:inputText value="#{MyWebSession.searchFirstName}"/>
                                        <h:outputText value="Gender"/>
                                        <h:selectOneMenu  label="Gender" value="#{MyWebSession.searchGender}"
                                                          >
                                            <f:selectItem  itemLabel="Any" itemValue="U" />
                                            <f:selectItem  itemLabel="Female" itemValue="F" />
                                            <f:selectItem  itemLabel="Male" itemValue="M" />
                                        </h:selectOneMenu>
                                        <p:commandButton  value="Search" id="studentFilterButton" actionListener="#{MyWebSession.doFilteredCaseloadList()}" update="mainAlert,growl,st_datatable"  >
                                        </p:commandButton>
                                        <h:outputText value=""/><h:outputText value=""/>
                                        <h:outputText value=""/>
                                        <p:commandButton  value="Clear Filter" id="studentListRefreshButton" actionListener="#{MyWebSession.refreshCaseloadList}" update="mainAlert,growl,st_datatable,filterStudentTableForm"  >
                                        </p:commandButton>
                                    </h:panelGrid>
                                </h:form>

Last edited by g4alliance on 03 Mar 2010, 23:52, edited 1 time in total.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

03 Mar 2010, 13:40

That issue might be fixed, can you try with a latest nightly build of 2.0.1?

Also why did you switch to an older version of 2.0 branch?

g4alliance
Posts: 22
Joined: 02 Feb 2010, 00:24

03 Mar 2010, 14:20

I didn't know I was switching to an older version.....
I had been using 2.0.0RC and I saw the release of 2.0.0 and decided to upgrade to the stable/production release.
I just grabbed the one from the web page....and added to maven.....

Well....that's what I thought I did...unless I'm mistaken....
As for nightly builds(nightly builds in general that is).....I've had some major hassles with those before, so I don't like to mess with them unless I have too.

Anyway, I ended up using the RequestContext to do partialUpdates.
ie-

Code: Select all

        requestContext.addPartialUpdateTarget("st_datatable");
    
Not optimal to have it there....since some objects could get called more than once unless I'm super careful...
But it worked!!
:)

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

03 Mar 2010, 15:01

Sorry I read your post wrong, yes you switched to a newer version. :)

Your JSF page is quite big to understand the problematic part, when does the error happen? Which component triggers the error?

g4alliance
Posts: 22
Joined: 02 Feb 2010, 00:24

03 Mar 2010, 23:48

I determined (after reading more and basically brute force of pulling everything out and adding one back at a time) that it was unnamed elements.

Now everything has an ID and it doesn't break for anyone :D

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

04 Mar 2010, 14:46

Oh I see, great then :)

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 31 guests