INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Facelet will not render

Facelet will not render

(OP)
I have done a couple projects using JSF and facelets, but it has been awhile since I set up a new one from scratch. I think I have all the pieces in place but the facelet will not render. Can anyone tell me what I am missing? The last piece of code is the resulting HTML page. The <application:signIn></application:signIn> line is where the facelet is supposed to render, but some link must be missing.

Thank you in advance!
Jon

faces-config.xml

CODE --> XML

<!DOCTYPE faces-config PUBLIC
  "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
  "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">

<faces-config>

	<application>
    	<locale-config>
    	  <default-locale>en</default-locale>
	    </locale-config>
		<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
	</application>
	
	<!-- Navigation Forwarding -->
	<navigation-rule>
		<from-view-id>/signIn.jsf</from-view-id>
		<navigation-case>
			<description></description>
			<from-outcome>success</from-outcome>
			<to-view-id>/signIn.jsf</to-view-id>
		</navigation-case>
		<navigation-case>
			<description></description>
			<from-outcome>retry</from-outcome>
			<to-view-id>/signIn.jsf</to-view-id>
		</navigation-case>
	</navigation-rule>	
	
</faces-config> 

web.xml

CODE --> XML

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>TicketingAdmin</display-name>
  <welcome-file-list>
    <welcome-file>signIn.jsf</welcome-file>
  </welcome-file-list>

  <context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.jsf</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>*.jsf</url-pattern>
  </servlet-mapping>

  <context-param>
    <param-name>javax.faces.FACELETS_LIBRARIES</param-name>
    <param-value>
      /WEB-INF/facelets/tags/application.taglib.xml
    </param-value>
  </context-param>

</web-app> 

template.jsf

CODE --> HTML

<html xmlns:jsp="http://java.sun.com/JSP/Page"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	version="2.0">

	<body>	

<ui:composition>	
<html>
	<head>
		<title>
			<ui:insert name="title">Ticketing System</ui:insert>
		</title>	
		<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
		<ui:insert name="stylesheet"></ui:insert>
	</head>
	<body>
	<f:view>
	
    <div id="UI" class="userInterface">
        <div id="Hdr_UI" class="header">
            <h1 class="title"><ui:insert name="uiTitle">Ticketing System</ui:insert></h1>
            <div class="logo"></div>
            
            <div id="Loader" class="loader" style="display:none;">
            	<div id="Ldr_Text" class="data datLoaderText">Loading...</div>
            </div>
            
            <span class="tagLine"><ui:insert name="uiTagLine">Facility name goes here</ui:insert></span>
            
            <div class="navigation">
            </div>
        </div>
		<ui:insert name="uiApplications"></ui:insert>	
        <div id="Ftr_UI" class="footer">
        	<ui:insert name="uiFooter"></ui:insert>
        </div>
	</div>		
		
		<ui:insert name="uiScriptModels"></ui:insert>	
		<ui:insert name="uiScriptBehaviors"></ui:insert>	
	</f:view>

	</body>
</html>	
</ui:composition>
	
	</body>
</html> 

signIn.jsf (facelet)

CODE --> HTML

<html xmlns:jsp="http://java.sun.com/JSP/Page"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	version="2.0">
	<body>

<ui:composition>

    <div id="App_SignIn" class="application">
        <div id="PV_Application" class="module panelView">
            <div class="header">
                <h2 class="title">Ticketing Administration</h2>
            </div>
            <div id="Cnt_Main" class="content">
            	Sign in here...
            </div>
            <div class="footer"></div>
        </div>
        <div id="Frozen_App_Ticketing" class="frozen" style="display:none;"></div>
    </div>
	
</ui:composition>	

	</body>
</html> 

application.taglib.xml

CODE --> XML

<?xml version="1.0"?>
<!DOCTYPE facelet-taglib PUBLIC
  "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
  "facelet-taglib_1_0.dtd">
<facelet-taglib>
	<namespace>http://ej.com/mf/application</namespace>
	<tag>
		<tag-name>signIn</tag-name>
		<source>application/signIn.jsf</source>
	</tag>
</facelet-taglib> 

signIn.jsf (main page)

CODE --> HTML

<html xmlns:jsp="http://java.sun.com/JSP/Page"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:application="http://ej.com/mf/application"
	version="2.0">

	<body>	

<ui:composition template="/WEB-INF/application/template.jsf">

	<ui:define name="uiTagLine">
	</ui:define>
	<ui:define name="uiScriptModels">
	</ui:define>
	<ui:define name="uiScriptBehaviors">
	</ui:define>
	
	<application:signIn />	
	<ui:define name="uiApplications">
		<application:signIn />	
	</ui:define>

</ui:composition>

	</body>
</html> 

Resulting page

CODE --> HTML

<html>
	<head>
		<title>Ticketing System
		</title>	
		<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
	</head>
	<body>
	
    <div id="UI" class="userInterface">
        <div id="Hdr_UI" class="header">
            <h1 class="title">Ticketing System</h1>
            <div class="logo"></div>
            
            <div id="Loader" class="loader" style="display:none;">
            	<div id="Ldr_Text" class="data datLoaderText">Loading...</div>
            </div>
            
            <span class="tagLine"></span>
            
            <div class="navigation">
            </div>
        </div>
		<application:signIn></application:signIn>	
        <div id="Ftr_UI" class="footer">
        </div>
	</div>

	</body>
</html> 

RE: Facelet will not render

(OP)
I found my problem, or problems. The funny thing is now I'm not sure how my current projects are working!

First problem was my taglib.xml couldn't be found. I simply had it in the wrong folder. Once I moved it to the correct place I got past the rendering problem.

Then I got the following error:
javax.servlet.ServletException: PWC1232: Exceeded maximum depth for nested request dispatches: 20

After researching this awhile I found that I didn't have things configured right.

First, in my faces-config.xml I needed to change my opening tag and comment out the view-handler:

CODE --> XML

<?xml version="1.0" encoding="UTF-8"?>
<faces-config 
   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-facesconfig_2_0.xsd" 
   version="2.0">
	
	<!-- 
	<application>
    	<locale-config>
    	  <default-locale>en</default-locale>
	    </locale-config>
		<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
	</application>
	--> 

Then in my web.xml I needed to change my default suffix to .xhtml

CODE --> XML

<context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</param-value>
  </context-param> 

And finally I had to rename my main page signIn.jsf to signIn.xhtml. Then viola, it worked!!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close