NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
ouribeb930
Joined: 01 Apr 2009 Posts: 93
|
Posted: Sun Sep 12, 2010 10:22 am Post subject: JSF Templates |
|
|
Hi,
Hope you are well...
I got a litle problem. I just made a jsf 2.0 project. I am using templates.
The organization of my project is
./WEB-INF/sun-web.xml, web.xml (as usual)
./resources/css/css1.css, css2.css
./resources/templates/template1.xhtml, template2.xhtml (jsf templates)
./index.xhtml (initial page), page1.xhtml (referenced page from index.xhtml)
The template1.xhtml use css1.css
The index.xhtml use template1.xhtml and this works well, all the visualization and jsf templating is functional. The page shows the correct css visualization and the jsf templates are replaced with the xhtml tags correctly.
The template2.xhtml use css2.css
The page1.xhtml use template2.xhtml and this is not working. Does somebody knows why?. When I see the source code from the page1.xhtml, it shows the jsf tags for templating instead of replacing it for the respective xhtml tags. The page also dont apply the css visualization.
I tryed to put the page1.xhtml as a welcome page (start page) and the page css visualization were correct and the jsf tags were replaced correctly.
But when referenced from a local link the page templating dont work.
Thaks. Hope you can help me. Maybe is something that I forget, I m new to this tecnology. |
|
| Back to top |
|
 |
ouribeb930
Joined: 01 Apr 2009 Posts: 93
|
Posted: Mon Sep 13, 2010 12:29 am Post subject: Hi |
|
|
I tryed to do another web application, with the JavaServer Faces framework, but the result its the same.
The index.xhtml page apply the jsf template and the css, but the second page, do not.
Its there something wrong with the framework?
Please, can someone help me?
Or my question its stupid? |
|
| Back to top |
|
 |
Rick Posted via mailing list.
|
Posted: Mon Sep 13, 2010 6:37 am Post subject: Re: JSF Templates |
|
|
Give it a little time, it's the weekend and the list is not very
active until the business week.
It's hard to tell anything without posting your code, but it sounds like
you do not have the template client set up properly to load the template
for the second page.
Try looking at your page source in the browser and see which css and
resource actually got loaded.
Be sure you have the ui:define and ui:composition tags in the right place.
Rick
On 9/12/2010 8:29 PM, ouribeb930 wrote:
| Quote: | I tryed to do another web application, with the JavaServer Faces framework, but the result its the same.
The index.xhtml page apply the jsf template and the css, but the second page, do not.
Its there something wrong with the framework?
Please, can someone help me?
Or my question its stupid?
|
On 9/12/2010 6:23 AM, ouribeb930 wrote:
| Quote: | Hi,
Hope you are well...
I got a litle problem. I just made a jsf 2.0 project. I am using templates.
The organization of my project is
./WEB-INF/sun-web.xml, web.xml (as usual)
./resources/css/css1.css, css2.css
./resources/templates/template1.xhtml, template2.xhtml (jsf templates)
./index.xhtml (initial page), page1.xhtml (referenced page from index.xhtml)
The template1.xhtml use css1.css
The index.xhtml use template1.xhtml and this works well, all the visualization and jsf templating is functional. The page shows the correct css visualization and the jsf templates are replaced with the xhtml tags correctly.
The template2.xhtml use css2.css
The page1.xhtml use template2.xhtml and this is not working. Does somebody knows why?. When I see the source code from the page1.xhtml, it shows the jsf tags for templating instead of replacing it for the respective xhtml tags. The page also dont apply the css visualization.
I tryed to put the page1.xhtml as a welcome page (start page) and the page css visualization were correct and the jsf tags were replaced correctly.
But when referenced from a local link the page templating dont work.
Thaks. Hope you can help me. Maybe is something that I forget, I m new to this tecnology.
|
|
|
| Back to top |
|
 |
ouribeb930
Joined: 01 Apr 2009 Posts: 93
|
Posted: Mon Sep 13, 2010 8:14 pm Post subject: Thanks |
|
|
Hi Rick,
I apologyse, I were ansious, I wasnt trying to trouble anyone.
I always have been responded in one day, you people are very active...
Thanks for the response.
The css is not loaded. And the source code is the faces1.xhtml source. But the faces1.xhtml page references the template1.xhtml.
I was just trying to develop a library.
WEB-INF folder
This is the web.xml
| Code: | <?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" 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-app_3_0.xsd">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</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>/faces/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
</web-app> |
This is the sun-web.xml
| Code: | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD GlassFish Application Server 3.0 Servlet 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_3_0-0.dtd">
<sun-web-app error-url="">
<context-root>/Radio</context-root>
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</sun-web-app> |
The Web Pages folder
This is the index.xhtml
| Code: | <?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:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<title>Template List</title>
</h:head>
<h:body>
<ui:composition template="./resources/templates/template_index.xhtml">
<ui:define name="top">
<h:outputText value="TEMPLATE EXAMPLES" />
</ui:define>
<ui:define name="content">
<h:outputLink value="faces1.xhtml">Template 1</h:outputLink>
<br />
<h:outputLink value="faces2.xhtml">Template 2</h:outputLink>
<br />
<h:outputLink value="faces3.xhtml">Template 3</h:outputLink>
<br />
<h:outputLink value="faces4.xhtml">Template 4</h:outputLink>
<br />
<h:outputLink value="faces5.xhtml">Template 5</h:outputLink>
<br />
<h:outputLink value="faces6.xhtml">Template 6</h:outputLink>
<br />
<h:outputLink value="faces7.xhtml">Template 7</h:outputLink>
<br />
<h:outputLink value="faces8.xhtml">Template 8</h:outputLink>
<br />
</ui:define>
</ui:composition>
</h:body>
</html> |
The faces1.xhtml
| Code: | <?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:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<title>Template 1</title>
</h:head>
<h:body>
<ui:composition template="./resources/templates/template1.xhtml">
<ui:define name="top">
<h:outputText value="TEMPLATE 1"/>
</ui:define>
<ui:define name="content">
<h:outputText value="CONTENT"/>
</ui:define>
</ui:composition>
</h:body>
</html>
|
The ./resources/templates/ folder
This is the template_index.xhtml
| Code: | <?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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="./resources/css/template_index.css" rel="stylesheet" type="text/css" />
<title>Template Index</title>
</h:head>
<h:body>
<div id="container" class="container">
<div id="top" class="top">
<ui:insert name="top">Top</ui:insert>
</div>
<div id="content" class="content">
<ui:insert name="content">Content</ui:insert>
</div>
</div>
</h:body>
</html> |
The template1.xhtml
| Code: | <?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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="./resources/css/template_index.css" rel="stylesheet" type="text/css" />
<title>Template 1</title>
</h:head>
<h:body>
<div id="container" class="container">
<div id="top" class="top">
<ui:insert name="top">Top</ui:insert>
</div>
<div id="content" class="content">
<ui:insert name="content">Content</ui:insert>
</div>
</div>
</h:body>
</html>
|
The ./resources/css/ folder
The index.css
| Code: | root {
}
#container{
width: 100%;
}
#top {
/*
Establecer la posición del elemento normal
Los elementos se acomodan de acuerdo a su tipo (lineal, bloque)
*/
position: static;
margin: 1%;
padding: 1%;
border-width: medium;
border-style: solid;
height: 100px;
width: 95%;
}
#content {
position: static;
margin: 1%;
padding: 1%;
border-width: medium;
border-style: solid;
width: 95%
}
.container {
/*Establecer el color de fondo transparente*/
background-color: transparent;
}
.top {
background-color: #252310;
border-color: #c6b61f;
color: #c6b61f;
font-weight: bold;
text-align: center;
}
.content {
background-color: #c6b61f;
border-color: #252310;
color: #252310;
font-weight: bold;
} |
|
|
| Back to top |
|
 |
ouribeb930
Joined: 01 Apr 2009 Posts: 93
|
Posted: Tue Sep 14, 2010 1:28 am Post subject: Forget |
|
|
Hi again,
I forget to say that the code shown in the browser is not xhtml, it is the jsf faces1.xhtml page
Thanks again,
Hope you can help me...  |
|
| Back to top |
|
 |
Rick Posted via mailing list.
|
Posted: Tue Sep 14, 2010 3:08 am Post subject: Re: JSF Templates |
|
|
Hi,
You need to leave all the previous messages in your e-mail. I can't
remember now what the problem was and that part of this thread has been
deleted.
Can you post this again including the older parts of the thread?
Rick
On 9/13/2010 4:15 PM, ouribeb930 wrote:
| Quote: | Hi Rick,
I apologyse, I were ansious, I wasnt trying to trouble anyone. [Embarassed]
I always have been responded in one day, you people are very active... [Laughing]
Thanks for the response. :D
The css is not loaded. And the source code is the faces1.xhtml source. But the faces1.xhtml page references the template1.xhtml.
I was just trying to develop a library.
WEB-INF folder
This is the web.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" 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-app_3_0.xsd">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</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>/faces/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
</web-app>
This is the sun-web.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD GlassFish Application Server 3.0 Servlet 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_3_0-0.dtd">
<sun-web-app error-url="">
<context-root>/Radio</context-root>
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</sun-web-app>
The Web Pages folder
This is the index.xhtml
Code:
<?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:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<title>Template List</title>
</h:head>
<h:body>
<ui:composition template="./resources/templates/template_index.xhtml">
<ui:define name="top">
<h:outputText value="TEMPLATE EXAMPLES" />
</ui:define>
<ui:define name="content">
<h:outputLink value="faces1.xhtml">Template 1</h:outputLink>
<br />
<h:outputLink value="faces2.xhtml">Template 2</h:outputLink>
<br />
<h:outputLink value="faces3.xhtml">Template 3</h:outputLink>
<br />
<h:outputLink value="faces4.xhtml">Template 4</h:outputLink>
<br />
<h:outputLink value="faces5.xhtml">Template 5</h:outputLink>
<br />
<h:outputLink value="faces6.xhtml">Template 6</h:outputLink>
<br />
<h:outputLink value="faces7.xhtml">Template 7</h:outputLink>
<br />
<h:outputLink value="faces8.xhtml">Template 8</h:outputLink>
<br />
</ui:define>
</ui:composition>
</h:body>
</html>
The faces1.xhtml
Code:
<?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:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<title>Template 1</title>
</h:head>
<h:body>
<ui:composition template="./resources/templates/template1.xhtml">
<ui:define name="top">
<h:outputText value="TEMPLATE 1"/>
</ui:define>
<ui:define name="content">
<h:outputText value="CONTENT"/>
</ui:define>
</ui:composition>
</h:body>
</html>
The ./resources/templates/ folder
This is the template_index.xhtml
Code:
<?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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="./resources/css/template_index.css" rel="stylesheet" type="text/css" />
<title>Template Index</title>
</h:head>
<h:body>
<div id="container" class="container">
<div id="top" class="top">
<ui:insert name="top">Top</ui:insert>
</div>
<div id="content" class="content">
<ui:insert name="content">Content</ui:insert>
</div>
</div>
</h:body>
</html>
The template1.xhtml
Code:
<?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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="./resources/css/template_index.css" rel="stylesheet" type="text/css" />
<title>Template 1</title>
</h:head>
<h:body>
<div id="container" class="container">
<div id="top" class="top">
<ui:insert name="top">Top</ui:insert>
</div>
<div id="content" class="content">
<ui:insert name="content">Content</ui:insert>
</div>
</div>
</h:body>
</html>
The ./resources/css/ folder
The index.css
Code:
root {
}
#container{
width: 100%;
}
#top {
/*
Establecer la posición del elemento normal
Los elementos se acomodan de acuerdo a su tipo (lineal, bloque)
*/
position: static;
margin: 1%;
padding: 1%;
border-width: medium;
border-style: solid;
height: 100px;
width: 95%;
}
#content {
position: static;
margin: 1%;
padding: 1%;
border-width: medium;
border-style: solid;
width: 95%
}
.container {
/*Establecer el color de fondo transparente*/
background-color: transparent;
}
.top {
background-color: #252310;
border-color: #c6b61f;
color: #c6b61f;
font-weight: bold;
text-align: center;
}
.content {
background-color: #c6b61f;
border-color: #252310;
color: #252310;
font-weight: bold;
}
|
|
|
| Back to top |
|
 |
ouribeb930
Joined: 01 Apr 2009 Posts: 93
|
Posted: Tue Sep 14, 2010 2:15 pm Post subject: Hi Rick |
|
|
Hi,
You mean in a new thread or here?
well I will post it here again...
give me a litle bit .... |
|
| Back to top |
|
 |
Rick Posted via mailing list.
|
Posted: Tue Sep 14, 2010 3:51 pm Post subject: Re: JSF Templates |
|
|
I sent you an offline e-mail with some files that may help. Also, for
tutorials on JSF 2.0 see: http://www.coreservlets.com/JSF-Tutorial/jsf2/
Rick
On 9/13/2010 9:29 PM, ouribeb930 wrote:
| Quote: | Hi again,
I forget to say that the code shown in the browser is not xhtml, it is the jsf faces1.xhtml page
Thanks again,
Hope you can help me... :?
|
|
|
| Back to top |
|
 |
Rick Posted via mailing list.
|
Posted: Tue Sep 14, 2010 10:07 pm Post subject: Re: JSF Templates |
|
|
When you reply to a thread leave the old message. Like this message,
my reply is at the top, your original message is below. That way, we
can follow the whole thread without going back to look the old messages up.
You can set your mailer to do this automatically.
Rick
On 9/14/2010 10:15 AM, ouribeb930 wrote:
| Quote: | Hi,
You mean in a new thread or here?
well I will post it here again...
give me a litle bit ....
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|