You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by hns <ha...@yahoo.com> on 2008/07/30 10:27:37 UTC
[trinidad]faces
hi
i am newbie to facelets and try to invoke in my test application
i have created template.xhtml in web-inf/layout to use it in my page1.jspx
it can not show facelets perfectly
error while first time page1 load comes that
--------------------------------------------------------------------------
com.sun.facelets.FaceletException: Error Parsing /decorator/images/Blue.css:
Error Traced[line: 1] Content is not allowed in prolog.
at com.sun.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:234)
at com.sun.facelets.compiler.Compiler.compile(Compiler.java:105)
at
com.sun.facelets.impl.DefaultFaceletFactory.createFacelet(DefaultFaceletFactory.java:197)
..............
---------------------------------------------------------------------------
my template.xhtml 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">
<head>
<title><ui:insert name="title">Test Demo</ui:insert></title>
<link rel="stylesheet" type="text/css"
href="./decorator/images/Blue.css"/>
</head>
<body>
<div id="wrap">
<div id="header">
<ui:insert name="header">
<ui:include src="header.xhtml"/>
</ui:insert>
</div>
<div id="menu">
<ui:insert name="menu">
menu will be here
</ui:insert>
</div>
<!-- content-wrap starts here -->
<div id="content-wrap">
<div id="sidebar">
<ui:insert name="sidebar">
<ui:include src="sidebar.xhtml"/>
</ui:insert>
</div>
<div id="main">
<ui:insert name="main">
Main code will be here
</ui:insert>
</div>
<!-- content-wrap ends here -->
</div>
<!--footer starts here-->
<div id="footer">
<ui:insert name="footer">
<ui:include src="footer.xhtml"/>
</ui:insert>
</div>
<!-- wrap ends here -->
</div>
</body>
</html>
-----------------------------------------------------------------------
another page1.jspx is like
-----------------------------------------------------------------------
<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:tr="http://myfaces.apache.org/trinidad"
xmlns:ui="http://java.sun.com/jsf/facelets" >
<jsp:directive.page contentType="text/html;charset=utf-8"/><br />
<f:view>
<tr:document title="demo">
<tr:panelPage>
<ui:composition template="/WEB-INF/layout/template.xhtml">
<ui:define name="header">
</ui:define>
<ui:define name="menu">
</ui:define>
<ui:define name="sidebar">
</ui:define>
<ui:define name="main">
<tr:form>
<tr:inputText label="Your name:" id="input1" value="#{helloTest.name}"
required="true"></tr:inputText>
<tr:commandButton id="button1" text="Press Me"
action="#{helloTest.send}"></tr:commandButton>
</tr:form>
</ui:define>
</ui:composition>
</tr:panelPage>
</tr:document>
</f:view>
</jsp:root>
-----------------------------------------------------------------------
one another thing i want to ask because i am at entry point of facelets is
that
i have use
<ui:composition template="/WEB-INF/layout/template.xhtml">
in page1.jspx bcoz i want to use this template in page, but this is common
layout to all page
so i have to use this method in all page?
please help me
thanks in advance
--
View this message in context: http://www.nabble.com/-trinidad-faces-tp18728342p18728342.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.
Re: [trinidad]faces
Posted by Matthias Wessendorf <ma...@apache.org>.
I'd use <tr:document> inside the "master template"
and the "metaContainer" facet to link to custom files like CSS, JS, etc.
See here:
http://code.google.com/p/facesgoodies/source/browse/trunk/src/main/webapp/WEB-INF/facelets/layout/template.xhtml
Greetings,
Matthias
On Wed, Jul 30, 2008 at 10:27 AM, hns <ha...@yahoo.com> wrote:
>
> hi
> i am newbie to facelets and try to invoke in my test application
> i have created template.xhtml in web-inf/layout to use it in my page1.jspx
>
> it can not show facelets perfectly
>
> error while first time page1 load comes that
> --------------------------------------------------------------------------
>
> com.sun.facelets.FaceletException: Error Parsing /decorator/images/Blue.css:
> Error Traced[line: 1] Content is not allowed in prolog.
> at com.sun.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:234)
> at com.sun.facelets.compiler.Compiler.compile(Compiler.java:105)
> at
> com.sun.facelets.impl.DefaultFaceletFactory.createFacelet(DefaultFaceletFactory.java:197)
>
> ..............
> ---------------------------------------------------------------------------
>
> my template.xhtml 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">
> <head>
> <title><ui:insert name="title">Test Demo</ui:insert></title>
> <link rel="stylesheet" type="text/css"
> href="./decorator/images/Blue.css"/>
> </head>
>
> <body>
>
> <div id="wrap">
> <div id="header">
> <ui:insert name="header">
> <ui:include src="header.xhtml"/>
> </ui:insert>
>
> </div>
> <div id="menu">
> <ui:insert name="menu">
> menu will be here
> </ui:insert>
>
> </div>
> <!-- content-wrap starts here -->
> <div id="content-wrap">
> <div id="sidebar">
> <ui:insert name="sidebar">
> <ui:include src="sidebar.xhtml"/>
> </ui:insert>
>
> </div>
> <div id="main">
> <ui:insert name="main">
> Main code will be here
> </ui:insert>
>
> </div>
> <!-- content-wrap ends here -->
> </div>
> <!--footer starts here-->
> <div id="footer">
> <ui:insert name="footer">
> <ui:include src="footer.xhtml"/>
> </ui:insert>
> </div>
> <!-- wrap ends here -->
> </div>
>
>
> </body>
>
> </html>
> -----------------------------------------------------------------------
>
> another page1.jspx is like
>
> -----------------------------------------------------------------------
> <?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
> xmlns:f="http://java.sun.com/jsf/core"
> xmlns:tr="http://myfaces.apache.org/trinidad"
> xmlns:ui="http://java.sun.com/jsf/facelets" >
>
>
>
> <jsp:directive.page contentType="text/html;charset=utf-8"/><br />
> <f:view>
>
> <tr:document title="demo">
>
>
> <tr:panelPage>
> <ui:composition template="/WEB-INF/layout/template.xhtml">
>
> <ui:define name="header">
> </ui:define>
> <ui:define name="menu">
> </ui:define>
> <ui:define name="sidebar">
>
> </ui:define>
>
> <ui:define name="main">
> <tr:form>
> <tr:inputText label="Your name:" id="input1" value="#{helloTest.name}"
> required="true"></tr:inputText>
> <tr:commandButton id="button1" text="Press Me"
> action="#{helloTest.send}"></tr:commandButton>
> </tr:form>
> </ui:define>
> </ui:composition>
> </tr:panelPage>
>
>
>
> </tr:document>
> </f:view>
>
>
>
> </jsp:root>
>
> -----------------------------------------------------------------------
>
>
> one another thing i want to ask because i am at entry point of facelets is
> that
> i have use
> <ui:composition template="/WEB-INF/layout/template.xhtml">
> in page1.jspx bcoz i want to use this template in page, but this is common
> layout to all page
> so i have to use this method in all page?
>
> please help me
> thanks in advance
> --
> View this message in context: http://www.nabble.com/-trinidad-faces-tp18728342p18728342.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>
--
Matthias Wessendorf
further stuff:
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
mail: matzew-at-apache-dot-org