繁体   English   中英

Spring 3 / JSF 2 / javax.faces.resource未正确加载

[英]Spring 3 / JSF 2 / javax.faces.resource not correclt loaded

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

  • 春天3.1.1发布
  • webflow 2.3.1。发布
  • richfaces 4.2.2。最终版
  • jsf com.sun.faces:jsf-api:2.1.7
  • jstl javax.servlet:jstl:1.2

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

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

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

GET http://feelgood-inc.net:8080/jrisk-web-ui/javax.faces.resource/richfaces.js可以

有没有人遇到过这个问题? 我不能摆脱每个javax.faces.resource调用前面的多余“ / *”。

我的faces-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>

我的春季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 />

将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>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM