user2476979
user2476979

Reputation: 31

jsf facelets menu image in header

i have developed web application using jsf facelets, i've configured a facelet for the ui header, menu, content and footer. But the problem is i've used one image in the header when logged in it shows the image when im clicking in the link in menu and redirected to next page the image is not displaying only when logged in it display else it won't display

here is my facelet template xhtml page

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

    <f:view contentType="text/html">
        <h:head>
            <f:facet name="first">
                <meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/>
                <title>PrimeFaces</title>
            </f:facet>
        </h:head>

        <h:body>

            <p:layout fullPage="true">

                <p:layoutUnit position="north" size="100" resizable="true" closable="true" collapsible="true">
                    <p:graphicImage value="logo.gif" />  
                </p:layoutUnit>

                <p:layoutUnit position="south" size="100" closable="true" collapsible="true">
                    Footer
                </p:layoutUnit>

                <p:layoutUnit position="west" size="180" header="Menu" collapsible="true">
                    <ui:insert name="leftmenu">
                        <div>
                            <ui:include src="leftmenu.xhtml" />
                        </div>
                    </ui:insert>
                </p:layoutUnit>

                <p:layoutUnit position="center">
                   <ui:insert name="content">
                        Select one of the links on the left to proceed.
                    </ui:insert>
                </p:layoutUnit>

            </p:layout>

        </h:body>

    </f:view>
</html>

my left menu xhtml page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"> 
<h:head></h:head> 
<body> 
<h:form>
    <h:link value="Home" outcome="homePage"></h:link>
    <br />
    <h:link value="Create User" outcome="addUser"></h:link>
    <br />
    <h:link value="Change Password" outcome="addUser"></h:link>
    <br />
    <h:link value="Allocation Tan" outcome="addUser"></h:link>
    <br />
    <h:link value="Batch Upload" outcome="addUser"></h:link>
    <br />
    <h:link value="XML Validation" outcome="addUser"></h:link>
    <br />
    <h:link value="Logout" outcome="login"></h:link>
</h:form>
</body> 
</html>

my add user xhtml page

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        <ui:composition template="/templates/template.xhtml">       
            <ui:define name="content">
               <h:form id="form">  

    <p:panel id="panel" header="New Person">  

        <p:messages id="msgs"/>  

        <p:commandButton id="btn" value="Save" update="panel" actionListener="#{user.save}"/>  
    </p:panel>  

</h:form>  
            </ui:define>
        </ui:composition>
    </h:body>
</html>

can anyone help me to solve this problem

Upvotes: 0

Views: 3269

Answers (1)

Alexandre Lavoie
Alexandre Lavoie

Reputation: 8771

Since your other template looks like to be in another directory, you should simply change the path of your image for an absolute one. You could even verify were your browser is trying to get this image when verifying the source code of the rendered page.

This should do the trick :

<p:graphicImage value="/logo.gif" />

Upvotes: 0

Related Questions