2012-08-13 51 views
-1

林新的RichFaces。對於我的應用程序,我不能將皮膚應用到我的數據表組件。我知道有關於這個https://community.jboss.org/thread/161480的現有線程,我遵循所有的配置,但皮膚仍然不會應用。見下圖。豐富的臉4.2.2.Final無法讓皮膚工作

enter image description here

我試過4.0.0.20101226-M5版本中提到的線程,但它仍然不會工作。這裏是我當前的代碼:

我的pom.xml

<properties> 
    <org.richfaces.bom.version>4.2.2.Final</org.richfaces.bom.version> 
    <webflow-version>2.3.1.RELEASE</webflow-version> 
    <mojarra-version>2.1.7</mojarra-version> 
</properties> 

    <!-- RichFaces --> 

    <dependency> 
     <groupId>org.richfaces.cdk</groupId> 
     <artifactId>annotations</artifactId> 
     <scope>provided</scope> 
     <version>${org.richfaces.bom.version}</version>   
    </dependency> 

    <dependency> 
     <groupId>org.richfaces.ui</groupId> 
     <artifactId>richfaces-components-ui</artifactId> 
    </dependency> 

    <dependency> 
     <groupId>org.richfaces.core</groupId> 
     <artifactId>richfaces-core-impl</artifactId> 
    </dependency> 

我的web.xml

<!-- Use JSF view templates saved as *.xhtml, for use with Facelets --> 
    <context-param> 
     <param-name>javax.faces.DEFAULT_SUFFIX</param-name> 
     <param-value>.xhtml</param-value> 
    </context-param> 
    <!-- Enables special Facelets debug output during development --> 
    <context-param> 
     <param-name>javax.faces.PROJECT_STAGE</param-name> 
     <param-value>Development</param-value> 
    </context-param> 

    <!-- Causes Facelets to refresh templates during development --> 
    <context-param> 
     <param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name> 
     <param-value>1</param-value> 
    </context-param> 

    <!-- Plugging the "Blue Sky" skin into the project --> 
    <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> 

    <context-param> 
     <param-name>org.richfaces.enableControlSkinningClasses</param-name> 
     <param-value>false</param-value> 
    </context-param> 

    <listener> 
     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-  
    class> 
    </listener> 
    <servlet> 
    <servlet-name>Spring MVC Dispatcher Servlet</servlet-name> 
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
    <init-param> 
    <param-name>contextConfigLocation</param-name> 
    <!-- change servlet-context.xml to web-application-config.xml --> 
    <param-value><!-- /WEB-INF/spring/web-application-config.xml --></param-value> 
    </init-param> 
    <load-on-startup>2</load-on-startup> 
</servlet> 

<servlet-mapping> 
    <servlet-name>Spring MVC Dispatcher Servlet</servlet-name> 
    <url-pattern>/spring/*</url-pattern> 
</servlet-mapping> 

<!-- Just here so the JSF implementation can initialize, *not* used at runtime --> 
<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> 

<welcome-file-list> 
     <welcome-file>index.html</welcome-file> 
</welcome-file-list> 

我的頁面

<?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"> 
<ui:composition 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"> 

<h:head> 
    <title>Data Tables</title> 
</h:head> 

<h:body> 
    <h3>JSF STARTED!</h3> 
<rich:panel> 

    <rich:dataTable value="#{userBean.users}" var="user" rows="5" > 
<rich:column> 
    <f:facet name="header">User</f:facet> 
    <h:outputText id="name" value="#{user.name}"/> 
</rich:column> 
<rich:column> 
    <f:facet name="header">Email</f:facet> 
    <h:outputText id="email" value="#{user.email}"/> 
</rich:column> 
</rich:dataTable> 

</rich:panel> 

</h:body> 
</ui:composition> 

對不起,文字的牆上,但任何意見給定將不勝感激!

+0

如果您在Web開發人員的角度描述什麼是最終失敗,而不是從最終用戶的角度來看,它會更有幫助。或者,你是否對網絡開發一般也是全新的? (即你根本不熟悉基本的HTTP和HTML?)首先,查看JSF生成的HTML源代碼,並檢查CSS引用是否正確,然後在Chrome/IE9/Firebug中按F12並檢查HTTP通信是否全部對。 – BalusC 2012-08-13 15:11:28

+0

我知道http和html的基礎,但是對於Spring MVC和RichFaces,我第一次嘗試。我遵循你的建議,並設法找出錯誤「無法獲得skinning.ecss」 – user1015935 2012-08-14 07:26:13

回答

4

嘗試用<html>標籤開始您的facelet。

<!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:f="http://java.sun.com/jsf/core" 
       xmlns:ui="http://java.sun.com/jsf/facelets" 
       xmlns:a4j="http://richfaces.org/a4j" 
       xmlns:rich="http://richfaces.org/rich"> 
     <h:head> 
     ... 
     </h:head> 

     <h:body> 
     ... 
     </h:body> 
</html> 

看看是否有幫助。