【发布时间】:2012-08-13 10:13:33
【问题描述】:
我是 RichFaces 的新手。对于我的应用程序,我无法将皮肤应用于我的数据表组件。我知道有关于这个https://community.jboss.org/thread/161480 的现有线程我遵循了所有配置,但皮肤仍然不会应用。见下图。
我尝试了线程中提到的 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>
对文字墙感到抱歉,但我们将不胜感激任何建议!
【问题讨论】:
-
如果您从 Web 开发人员的角度而不是从最终用户的角度描述究竟是什么失败了,将会更有帮助。或者您对 Web 开发也完全陌生? (即您根本不熟悉基本的 HTTP 和 HTML?)首先,查看 JSF 生成的 HTML 源并检查 CSS 引用是否正确,然后在 Chrome/IE9/Firebug 中按 F12 并检查 HTTP 流量是否全部对。
-
我确实知道 http 和 html 的基本知识,但是对于 Spring MVC 和 RichFaces,这是我第一次尝试。我听从了您的建议并设法找出错误“无法获取 skinning.ecss”