• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Template not working

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
<h:outputStylesheet 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?
 
Saloon Keeper
Posts: 26290
186
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic