0

我正在尝试建立一个新项目,包括

  • 春天 3.1.1.RELEASE
  • 网络流 2.3.1.RELEASE
  • Richfaces 4.2.2.Final
  • jsf com.sun.faces:jsf-api:2.1.7
  • jstl javax.servlet:jstl:1.2

一切正常,除了 javax.faces.resource/* 似乎无法访问。

获取http://feelgood-inc.net:8080/jrisk-web-ui/ */javax.faces.resource/richfaces.js 404(未找到)

我怀疑问题来自“javax.faces”前面的“/ /”。当我删除 /时,它工作正常。

获取http://feelgood-inc.net:8080/jrisk-web-ui/javax.faces.resource/richfaces.js作品!

有没有人遇到过这个问题?我无法摆脱每个 javax.faces.resource 调用前面的额外“/ *”......

我的面孔-config.xml

<faces-config xmlns="http://java.sun.com/xml/ns/javaee" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"              
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
       http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd"
version="2.1">

</faces-config>

我的 web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

<!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/spring/root-context.xml</param-value>
</context-param>

<!-- Creates the Spring Container shared by all Servlets and Filters -->
<!-- The Bootstrap listener to start up and shut down Spring's root WebApplicationContext. It is registered to Servlet Container -->
<listener>
    <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</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>0</load-on-startup>
</servlet>

<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/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-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.faces</url-pattern>
</servlet-mapping>

<context-param> 
    <param-name>javax.faces.FACELETS_VIEW_MAPPINGS</param-name>
    <param-value>*.xhtml</param-value>
</context-param>

我的spring mvc配置

    <beans:bean name="richfacesResourceHandler"      
 class="org.springframework.faces.webflow.JsfResourceRequestHandler" />

<beans:bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    <beans:property name="order" value="0" />
    <beans:property name="mappings">
        <beans:value>
            /javax.faces.resource/*=richfacesResourceHandler
            /rfRes/**=richfacesResourceHandler
        </beans:value>
    </beans:property>
</beans:bean>

<faces:resources />
4

2 回答 2

1

将 2.1 更改为 2.0 怎么样?

<faces-config xmlns="http://java.sun.com/xml/ns/javaee" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"              
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
       http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" version="2.0">
</faces-config>
于 2012-09-26T08:17:51.320 回答
0

看看这张 JIRA 票:

https://jira.springsource.org/browse/SWF-1552

于 2012-10-01T15:06:45.263 回答