ui:inculde inside a tab

UI Components for JSF
Post Reply
Lotfus
Posts: 46
Joined: 14 Mar 2011, 13:02
Location: Swtizerland-Lausanne

16 Mar 2011, 16:33

Hello,

I am trying to include a custom component inside a tab, but it doesn't work. Here is my code:

Code: Select all

<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml" 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:sf="http://www.springframework.org/tags/faces" xmlns:p="http://primefaces.prime.com.tr/ui"
    xmlns:sec="http://www.springframework.org/security/tags" template="/WEB-INF/layouts/standard.xhtml"
    xmlns:c="http://java.sun.com/jsp/jstl/core">

    <ui:define name="content">

<!--        <p:panel>-->
<!--            <ui:include src="/search.xhtml" />-->
<!--        </p:panel>-->

        <p:tabView>
            <p:tab>
                    <ui:include src="/search.xhtml" />
            </p:tab>
        </p:tabView>

    </ui:define>
</ui:composition>
So the commented part above works, but the one inside a tabview doesn't. And here is my search.xhtml:

Code: Select all

<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:component xmlns="http://www.w3.org/1999/xhtml" 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:sf="http://www.springframework.org/tags/faces" xmlns:p="http://primefaces.prime.com.tr/ui"
    xmlns:sec="http://www.springframework.org/security/tags" xmlns:c="http://java.sun.com/jsp/jstl/core">

            <h:form id="rechercheForm">
                <table>
                    <tr>
                        <td>First Name:</td>
                        <td><h:inputText label="First Name" id="fname" value="#{citizen.firstName}" required="true" />
                        <h:message for="fname" /></td>
                    </tr>
                    <tr>
                        <td>Last Name:</td>
                        <td><h:inputText label="Last Name" id="lname" value="#{citizen.lastName}" required="true" />
                        <h:message for="lname" /></td>
                    </tr>
                    <tr>
                        <td>Sex:</td>
                        <td><h:selectOneRadio label="Sex" id="sex" value="#{citizen.sex}" required="true">
                            <f:selectItem itemLable="Male" itemValue="male" />
                            <f:selectItem itemLable="Female" itemValue="female" />
                        </h:selectOneRadio> <h:message for="sex" /></td>
                    </tr>
                    <tr>
                        <td>Date of Birth:</td>
                        <td><h:inputText label="Date of Birth" id="dob" value="#{citizen.dob}" required="true">
                            <f:convertDateTime pattern="MM-dd-yy" />
                        </h:inputText> (mm-dd-yy) <h:message for="dob" /></td>
                    </tr>
                    <tr>
                        <td>Email Address:</td>
                        <td><h:inputText label="Email Address" id="email" value="#{citizen.email}" required="true"
                            validator="#{citizen.validateEmail}" /> <h:message for=" email" /></td>
                    </tr>
                </table>
                <p><h:messages /></p>
                <p><h:commandButton value="Recherche" action="#{searchPeopleController.searchUER}" /></p>
            </h:form>
</ui:component>
here is the trace of the error:

Code: Select all

java.lang.NullPointerException
	at org.apache.catalina.connector.CoyoteWriter.write(CoyoteWriter.java:171)
	at com.sun.faces.application.view.WriteBehindStateWriter.write(WriteBehindStateWriter.java:123)
	at com.sun.faces.renderkit.html_basic.HtmlResponseWriter.write(HtmlResponseWriter.java:662)
	at org.primefaces.component.tabview.TabViewRenderer.encodeHeaders(TabViewRenderer.java:153)
	at org.primefaces.component.tabview.TabViewRenderer.encodeMarkup(TabViewRenderer.java:119)
	at org.primefaces.component.tabview.TabViewRenderer.encodeEnd(TabViewRenderer.java:61)
	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:389)
	at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:127)
	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:117)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
	at java.lang.Thread.run(Thread.java:662)
Any explanation please!?

Thanks.

Lotfus
Posts: 46
Joined: 14 Mar 2011, 13:02
Location: Swtizerland-Lausanne

16 Mar 2011, 17:06

I found the solution, or at least one solution:


setting the "title" attribute solved the problem:

Code: Select all

        <p:tabView>
            <p:tab title="Recherche">
                    <ui:include src="/search.xhtml" />
            </p:tab>
        </p:tabView>

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 50 guests