no theme active

UI Components for JSF
Post Reply
greg341975
Posts: 2
Joined: 09 Jan 2011, 17:24

09 Jan 2011, 17:40

Hello,

I develop my first page using myface 2 or majora 2.0.3.

Here is the structure of apps :

http://www.imagup.com/data/1109260417.html

I think there there is no css active :
http://www.imagup.com/data/1109259684.html

Here is my web.xml

Code: Select all

<?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>oracle</display-name>
  <welcome-file-list>
    <welcome-file>faces/index.jsp</welcome-file>
  </welcome-file-list>
  <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>
  
  <context-param>
		<param-name>primefaces.skin</param-name>
		<param-value>none</param-value>
	</context-param>
	
  <servlet>
		<servlet-name>Resource Servlet</servlet-name>
		<servlet-class>org.primefaces.resource.ResourceServlet</servlet-class>
	</servlet>
	<servlet-mapping>
		<servlet-name>Resource Servlet</servlet-name>
		<url-pattern>/primefaces_resource/*</url-pattern>
	</servlet-mapping>
	
	 <context-param>
        <param-name>com.sun.faces.allowTextChildren</param-name>
        <param-value>true</param-value>
    </context-param>
    
  <context-param>
    <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
  </context-param>
  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>resources.application</param-value>
  </context-param>
  <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
  </listener>
</web-app>
And my jsf

Code: Select all

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="f"  uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h"  uri="http://java.sun.com/jsf/html"%>
<%@ taglib prefix="p" uri="http://primefaces.prime.com.tr/ui"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link type="text/css" rel="stylesheet" href="redmond/skin.css"> 
<title>greg</title>
</head>

<body>

<f:view>
 <h:form id="form"> 

	<p:growl id="messages"/>

	<p:menubar>
		<p:submenu label="Barca" labelStyleClass="barca">
			<p:menuitem value="Home" url="http://www.fcbarcelona.com"></p:menuitem>
		</p:submenu>
		
		<p:submenu label="File">
			<p:submenu>
				<f:facet name="label">
					<p:menuitem value="New" icon="/images/new.png"/>
				</f:facet>
				<p:menuitem value="Project" url="#" helpText="CTRL+N"/>
				<p:menuitem value="Other" url="#" helpText="CTRL+O"/>
			</p:submenu>
			<p:menuitem value="Open" url="#" icon="/images/open.png" />
			<p:menuitem value="Quit" url="#"></p:menuitem>
		</p:submenu>
		
		<p:submenu label="Edit">
			<p:menuitem value="Undo" url="#" styleClass="undo" 
						helpText="CTRL+Z" icon="/images/undo.png"></p:menuitem>
			<p:menuitem value="Redo" url="#" styleClass="redo" 
						helpText="CTRL+Y" icon="/images/redo.png"></p:menuitem>
		</p:submenu>
		
		<p:submenu label="Help">
			<p:menuitem value="Contents" url="#"></p:menuitem>
			<p:submenu>
				<f:facet name="label">
					<p:menuitem value="Search" icon="/images/search.png" />
				</f:facet>
				
				<p:submenu label="Text">
					<p:menuitem value="Workspace" url="#" />
				</p:submenu>
				<p:menuitem value="File" url="#" />
			</p:submenu>
		</p:submenu>
		
		<p:submenu label="Actions">
			<p:submenu label="Ajax">
				<p:menuitem value="Save" update="messages" 
						actionListener="#{menuBean.save}" />
				<p:menuitem value="Update" update="messages" 
						actionListener="#{menuBean.update}" />
			</p:submenu>
			<p:submenu label="Non-Ajax">
				<p:menuitem value="Delete" update="messages" ajax="false" 
						actionListener="#{menuBean.delete}" />
			</p:submenu>
		</p:submenu>
		
		<p:submenu>
			<f:facet name="label">
				<p:menuitem value="Quit" url="http://www.primefaces.org" />
			</f:facet>
		</p:submenu>
	</p:menubar>
	
	<p:ajaxStatus style="width:16px;height:16px;">
		<f:facet name="start">
			<h:graphicImage value="../design/ajaxloading.gif" />
		</f:facet>
		
		<f:facet name="complete">
			<h:outputText value="" />
		</f:facet>
	</p:ajaxStatus>

</h:form>


</f:view>
<body>
</html>
Can someone give me a clue to apply the theme correctly ?

Thx

User avatar
bumble.bee
Posts: 723
Joined: 29 Sep 2010, 21:39
Location: United States

10 Jan 2011, 16:26

Remember that only Facelets can be used with PrimeFaces. Your base template could look something like this:

Code: Select all

<?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"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">
    <f:view contentType="text/html" encoding="UTF-8">
        <h:head>
            <link type="text/css" rel="stylesheet" media="screen" href="#{request.contextPath}/resources/themes/sunny/skin.css"/>
            <title>MyTitle</title>
        </h:head>
        <h:body>
        ...
        </h:body>
    </f:view>
</html>
where sunny is replaced by the theme of your choice and is located on your server at /resources/themes/ (or change the path).

greg341975
Posts: 2
Joined: 09 Jan 2011, 17:24

10 Jan 2011, 20:54

ok thx,

This solve my problem.

bye
greg

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 49 guests