我一直试图让上面提到的设置工作几天,但收效甚微。我的问题似乎与资源处理程序有关。 IE浏览器。
<h:outputStylesheet name="header.css" library="page"/>
不起作用,NOR可以解析RichFaces内部使用的任何资源。所以我做了一些调查,上面的标签应该解析为“/project/javax.faces.resource/header.css?ln=page”,但事实并非如此。 2个明显的问题正在发生。
1)资源处理程序链中的某些东西,可能是richfaces处理程序,期望将“.jsf”后缀添加到所请求的URL,这在使用旧的EXTERNAL facelets w / JSF2&amp;时会发生。 RichFaces 3.3.x,但Richfaces 4&amp;内置的小面孔不会发生。结果,其中一个处理程序(RichFaces'我相信)正在剥离.css后缀,认为它是一个额外的后缀,就像以前一样工作。 (因此,这会导致缺少MIME类型错误)
2)当图书馆&amp;解析了name属性,在当前路径下解析而不是servlet上下文根。 IE浏览器。它应该解析为“/project/javax.faces.resource / ...”,而是在查看/ index目录中的页面时解析为“/project/index/javax.faces.resource / ...”。
有人可以在这里给我一些见解吗?我正在这个和我的头撞墙。没有任何真正的理由。
这是我的基本配置....
面-config.xml中
<application>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
</application>
的web.xml
<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>*.jsf</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Spring MVC Servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Spring MVC Servlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
servlet的context.xml中
<beans:bean class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<beans:property name="viewClass" value="org.springframework.faces.mvc.JsfView"/>
<beans:property name="prefix" value="/WEB-INF/content/" />
<beans:property name="suffix" value=".xhtml" />
</beans:bean>
<beans:bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
<beans:property name="order" value="2"/>
<beans:property name="flowRegistry" ref="flowRegistry" />
</beans:bean>
<beans:bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter">
<beans:property name="flowExecutor" ref="flowExecutor" />
<beans:property name="ajaxHandler">
<beans:bean class="org.springframework.faces.richfaces.RichFacesAjaxHandler"/>
</beans:property>
</beans:bean>
<beans:bean class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<beans:property name="viewClass" value="org.springframework.faces.mvc.JsfView"/>
<beans:property name="prefix" value="/WEB-INF/content/" />
<beans:property name="suffix" value=".xhtml" />
</beans:bean>
<beans:bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" />
<beans:bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<beans:property name="order" value="3" />
<beans:property name="alwaysUseFullPath" value="true" />
<beans:property name="mappings">
<beans:value>
</beans:value>
</beans:property>
<beans:property name="defaultHandler">
<beans:bean class="org.springframework.web.servlet.mvc.UrlFilenameViewController" />
</beans:property>
</beans:bean>
的Webflow-config.xml中
<faces:resources/>
<beans:bean id="facesContextListener" class="org.springframework.faces.webflow.FlowFacesContextLifecycleListener"/>
<flow-executor id="flowExecutor">
<flow-execution-listeners>
<listener ref="facesContextListener"/>
</flow-execution-listeners>
</flow-executor>
<flow-registry id="flowRegistry" base-path="/WEB-INF/content" flow-builder-services="flowBuilderServices">
<flow-location-pattern value="/**/flow.xml" />
</flow-registry>
<flow-builder-services id="flowBuilderServices" development="true" />
答案 0 :(得分:4)
好的,所以我最终在Rich Faces的帮助下钉了这个......对于有兴趣在Tomcat6 +上运行JSF2 + Rich Faces + SpringMVC + Spring WebFlow的人来说,这就是你需要的......
<强> WEB.XML 强>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/config/appServlet/servletContext.xml</param-value>
</context-param>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<servlet>
<servlet-name>faces</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet>
<servlet-name>spring</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>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/app/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>faces</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<context-param>
<param-name>javax.faces.FACELETS_VIEW_MAPPINGS</param-name>
<param-value>*.xhtml</param-value>
</context-param>
<强> servletContext.xml 强>
<mvc:annotation-driven />
<context:component-scan base-package="com.package.subpackage"/>
<mvc:resources location="/" mapping="/resources/**" />
<faces:resources order="0" />
<bean id="flowHandlerMapping"
class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
<property name="flowRegistry" ref="flowRegistry" />
<property name="order" value="3" />
<property name="defaultHandler" ref="defaultHandler" />
</bean>
<bean class="org.springframework.faces.webflow.JsfFlowHandlerAdapter">
<property name="flowExecutor" ref="flowExecutor" />
<property name="ajaxHandler">
<bean class="org.springframework.faces.richfaces.RichFacesAjaxHandler" />
</property>
</bean>
<bean class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.faces.mvc.JsfView"/>
<property name="prefix" value="/WEB-INF/pageContent/" />
<property name="suffix" value=".xhtml" />
</bean>
<强>用SpringMVC-config.xml中强>
<bean name="jsfResourceHandlerHack" class="org.springframework.faces.webflow.JsfResourceRequestHandler" />
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="order" value="1" />
<property name="mappings">
<value>
/rfRes/**=jsfResourceHandlerHack
</value>
</property>
</bean>
<强>弹簧的Webflow-config.xml中强>
<!-- Executes flows: the central entry point into the Spring Web Flow system -->
<flow-executor id="flowExecutor">
<flow-execution-listeners>
<listener ref="facesContextListener"/>
</flow-execution-listeners>
</flow-executor>
<flow-registry id="flowRegistry" base-path="/WEB-INF/content" flow-builder-services="facesFlowBuilderServices">
<flow-location-pattern value="/**/flow.xml" />
<flow-location id="parent-flow" path="parent-flow.xml"/>
</flow-registry>
<faces:flow-builder-services id="facesFlowBuilderServices" development="true"/>
<beans:bean name="facesContextListener" class="org.springframework.faces.webflow.FlowFacesContextLifecycleListener" />
<强>弹簧豆-config.xml中强> `
<bean name="defaultHandler" class="org.springframework.web.servlet.mvc.UrlFilenameViewController" >
</bean>`
Jar版本如下...... Spring Core 3.0.5 Spring Web Flow 2.2.1 JSF RI 2.0.3 最重要的是...... Rich Faces 4.0.0.20101226-M5
因此,使这项工作的关键似乎是RichFaces的版本。 RichFaces 4尚未准备好生产,所以希望一旦发生这一切,一切都将顺利进行,但与此同时,现在Milestone 5已经发布,这个设置似乎有效。需要注意的部分是JsfResourceHandlerHack映射。 Richfaces默认使用关键字“rfRes”来尝试解析它的一些资源(我认为是动态创建的资源)。我遇到的问题是“rfRes”键未映射到资源处理程序。有一种方法可以配置它,但这似乎不起作用。因此,快速修复是创建另一个资源处理程序实例并手动映射它。所以对于任何有兴趣的人来说,就是这样。
答案 1 :(得分:1)
我认为您的问题已在https://jira.springsource.org/browse/SWF-1366中得到解答。
祝你好运