This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes JSF and the fly likes Template not working Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » JSF
Reply Bookmark "Template not working" Watch "Template not working" New topic
Author

Template not working

Mikel Martin
Greenhorn

Joined: Nov 15, 2012
Posts: 8
I am trying to implement a template and I think it is very simple and perfect,
but still not working.

The code of the template is:
<!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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
xmlns:f="http://java.sun.com/jsf/core">

<h:head>
<title><ui:insert name="windowTitle"/></title>
<hutputStylesheet library="css" name="styles.css"/>
<!--<link href="resources/styles.css" rel="stylesheet" type="text/css" ></link>-->
</h:head>

<h:body>
<div id="container">
<div id="header">
<ui:insert name="header">
Default header goes here
</ui:insert>
</div>


<div id="sidebarLeft">
<ui:insert name="sidebarLeft">
Default sidebarLeft goes here
</ui:insert>
</div>

<div id="sidebarRight">
<ui:insert name="sidebarRight">
Default sidebar right
</ui:insert>
</div>
<div id="footer">
<ui:insert name="footer">
Footer
</ui:insert>
</div>
<ui:debug/>
</div>
</h:body>
</html>

and the code of the user is:


<!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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
xmlns:f="http://java.sun.com/jsf/core">

<h:head>
<title>IGNORED</title>
</h:head>

<h:body>
<ui:composition template="/templates/masterLayout.xhtml">



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

The position of the files are:
- templates
---masterLayout.xhtml
- outlets.xhtml

The output should be the full written in the template, but nothing shows. The page is blank

What is wrong?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14572
    
    7

Welcome to the JavaRanch, Mikel!

You will find a "Code" button on our message editor that can wrap special tags around Java code, XML, and other pre-formatted text. It makes them easier to read.

If you get a blank page when using a template or include, there's a problem with the template that is being included.

Unfortunately, there's not likely to be any helpful messages, so what I do is strip down the included file to something basic like a "hello" outputText and keep adding back what I took out until I find the failing element.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Template not working
 
Similar Threads
Why events are not fired when value changes in h:selectOneMenu? I am stuck!
Error:The XML page cannot be displayed Cannot view XML input using style sheet
Problem trying to send file to browser in JSF
JSF 2.0 Login
Problem achieving masterpage functionality in JSF