RichFaces 4.0皮肤不起作用

时间:2011-04-28 10:13:04

标签: java jsf-2 richfaces

RichFaces 4.0皮肤不起作用。而是显示系统默认样式。

这是一个xhtml文件内容:

<!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:rich="http://richfaces.org/rich"
 xmlns:a4j="http://richfaces.org/a4j">

  <head>
   <title>RichFaces</title>
   <h:outputStylesheet name="/panel.ecss"/>
  </head>
  <body>
   <h:form>
  <rich:panel>
   <f:facet name="header">
    Just some users
   </f:facet>
   <rich:dataTable value="#{userBean.users}" var="user">
    <h:column>
     <h:outputText id="name" value="#{user.name}"/>
    </h:column>
    <h:column>
     <h:outputText id="email" value="#{user.email}"/>
    </h:column>
   </rich:dataTable>
  </rich:panel>
   </h:form>
  </body>
</html>

输出如下:

output

我的web.xml:

<?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>richfacesPrj</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.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>
    <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>
  <context-param>
      <param-name>org.richfaces.skin</param-name>
      <param-value>blueSky</param-value>
  </context-param>
  <context-param>  
    <param-name>org.richfaces.enableControlSkinning</param-name>  
    <param-value>true</param-value>  
  </context-param>
</web-app>

1 个答案:

答案 0 :(得分:1)

尝试使用h:head代替head。使用h:head,您的皮肤的css文件将包含在页面中。