我在JBoss EAP 6.1上使用RichFaces 4以及JSF,Spring和Spring Web Flow,从JBoss EAP 5.1上的相应技术迁移(例如,RichFaces 3.3)。
问题是rich:namespace中的任何组件或控件都会为它生成一些HTML,但是当它在浏览器中呈现时,它看起来与RichFaces展示站点上的相应组件完全不同。似乎有CSS和可能的图像文件应该与RichFaces jar文件捆绑在一起,但是浏览器无法找到它们。屏幕截图如下。
作为测试,我选择了一个简单的控件,即rich:collapsiblePanel,并将展示网站上的示例代码粘贴到我们应用程序的测试页面中。可折叠面板出现,但看起来不像演示网站上的那个。屏幕截图如下。
我在多个浏览器(IE,Firefox和Chrome)和多个富有的组件(丰富:extendedDataTable,rich:tabPanel,rich:calendar)中获得了相同的结果,所以我认为这指向了一个库或配置问题。
下面是我正在使用的库列表。
aopalliance-1.0.jar
aspectjweaver.jar
cglib-nodep-2.2.2.jar
commons-beanutils-1.8.3.jar
commons-codec-1.5.jar
commons-collections-3.2.1.jar
commons-digester-2.1.jar
commons-lang-2.6.jar
commons-logging-1.1.jar
cssparser-0.9.5.jar
guava-r09.jar
jdom.jar
log4j-1.2.16.jar
org.springframework.binding-2.3.2.RELEASE.jar
org.springframework.faces-2.3.2.RELEASE.jar
org.springframework.js-2.3.2.RELEASE.jar
org.springframework.js.resources-2.3.2.RELEASE.jar
org.springframework.webflow-2.3.2.RELEASE.jar
poi-3.8-20120326.jar
richfaces-components-api-4.3.2.Final-redhat-1.jar
richfaces-components-ui-4.3.2.Final-redhat-1.jar
richfaces-core-api-4.3.2.Final-redhat-1.jar
richfaces-core-impl-4.3.2.Final-redhat-1.jar
sac-1.3.jar
spring-aop-3.2.0.RELEASE.jar
spring-aspects-3.2.0.RELEASE.jar
spring-beans-3.2.0.RELEASE.jar
spring-context-3.2.0.RELEASE.jar
spring-context-support-3.2.0.RELEASE.jar
spring-core-3.2.0.RELEASE.jar
spring-expression-3.2.0.RELEASE.jar
spring-instrument-3.2.0.RELEASE.jar
spring-instrument-tomcat-3.2.0.RELEASE.jar
spring-jdbc-3.2.0.RELEASE.jar
spring-jms-3.2.0.RELEASE.jar
spring-orm-3.2.0.RELEASE.jar
spring-oxm-3.2.0.RELEASE.jar
spring-security-acl-3.1.3.RELEASE.jar
spring-security-aspects-3.1.3.RELEASE.jar
spring-security-cas-3.1.3.RELEASE.jar
spring-security-config-3.1.3.RELEASE.jar
spring-security-core-3.1.3.RELEASE.jar
spring-security-crypto-3.1.3.RELEASE.jar
spring-security-ldap-3.1.3.RELEASE.jar
spring-security-openid-3.1.3.RELEASE.jar
spring-security-remoting-3.1.3.RELEASE.jar
spring-security-taglibs-3.1.3.RELEASE.jar
spring-security-web-3.1.3.RELEASE.jar
spring-struts-3.2.0.RELEASE.jar
spring-test-3.2.0.RELEASE.jar
spring-tx-3.2.0.RELEASE.jar
spring-web-3.2.0.RELEASE.jar
spring-webmvc-3.2.0.RELEASE.jar
spring-webmvc-portlet-3.2.0.RELEASE.jar
这是我的web.xml,只更改了一些匿名部分(app-servlet.xml和com.app.class)。
<?xml version="1.0" encoding="ASCII"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/app-servlet.xml
</param-value>
</context-param>
<filter>
<filter-name>charEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>charEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<context-param>
<param-name>org.richfaces.skin</param-name>
<param-value>DEFAULT</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
<param-value>1</param-value>
</context-param>
<filter>
<filter-name>RewriteRequestHeaderFilter</filter-name>
<filter-class>com.app.class</filter-class>
</filter>
<filter-mapping>
<filter-name>RewriteRequestHeaderFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<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>
<param-value></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>
<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>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>
我还查看了似乎有关的this question和this question,但我找不到任何有助于解决问题的信息。
有什么建议吗?
答案 0 :(得分:2)
原来这是一个Spring配置问题。如果您使用的是Spring和/或Spring Web Flow,请在配置文件中检查以下代码。请注意,这些只是代码段,而不是完整的配置文件。
的Webflow-config.xml中
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:webflow="http://www.springframework.org/schema/webflow-config"
xmlns:faces="http://www.springframework.org/schema/faces"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/webflow-config
http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.3.xsd
http://www.springframework.org/schema/faces
http://www.springframework.org/schema/faces/spring-faces-2.2.xsd">
webmvc-config.xml中
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:faces="http://www.springframework.org/schema/faces"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/faces http://www.springframework.org/schema/faces/spring-faces-2.2.xsd">
<faces:resources />
<!-- Needed for RichFaces! -->
<bean name="richfacesResourceHandler" class="org.springframework.faces.webflow.JsfResourceRequestHandler" />
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="order" value="0" />
<property name="mappings">
<value>
/rfRes/**=richfacesResourceHandler
</value>
</property>
</bean>