未找到使用SpringWebFlow的URI-JSF资源的HTTP请求的映射

未找到使用SpringWebFlow的URI-JSF资源的HTTP请求的映射,jsf,primefaces,spring-webflow,Jsf,Primefaces,Spring Webflow,我正在尝试使用JSF(PrimeFaces3.1.1)和SpringWebFow2.3来设置一个web项目。我可以部署和启动我的索引页面,但我注意到p:commandButton似乎没有Primeface的外观 启动应用程序时,我在IDE控制台上看到以下警告: WARNING: No mapping found for HTTP request with URI [/client-ui/contact/javax.faces.resource/primefaces.css] in Dispatc

我正在尝试使用JSF(PrimeFaces3.1.1)和SpringWebFow2.3来设置一个web项目。我可以部署和启动我的索引页面,但我注意到p:commandButton似乎没有Primeface的外观

启动应用程序时,我在IDE控制台上看到以下警告:

WARNING: No mapping found for HTTP request with URI [/client-ui/contact/javax.faces.resource/primefaces.css] in DispatcherServlet with name 'DispatcherMVC'
WARNING: No mapping found for HTTP request with URI [/client-ui/contact/javax.faces.resource/theme.css] in DispatcherServlet with name 'DispatcherMVC'
WARNING: No mapping found for HTTP request with URI [/client-ui/contact/javax.faces.resource/primefaces.js] in DispatcherServlet with name 'DispatcherMVC'
WARNING: No mapping found for HTTP request with URI [/client-ui/contact/javax.faces.resource/jquery/jquery.js] in DispatcherServlet with name 'DispatcherMVC'
WEB-INF/WEB.xml webapp/index.jsp


BalusC的评论是正确的,但是,即使您遵循他的建议,您仍然可能会遇到Primefaces组件未正确渲染的问题。您尚未在
web.xml
中映射Primefaces资源Servlet

<servlet>
  <servlet-name>Resource Servlet</servlet-name>
  <servlet-class>org.primefaces.resource.ResourceServlet</servlet-class>
</servlet>
<servlet-mapping>
  <servlet-name>Resource Servlet</servlet-name>
  <url-pattern>/primefaces_resource/*</url-pattern>
</servlet-mapping>

资源Servlet
org.primefaces.resource.ResourceServlet
资源Servlet
/素数资源/*
此servlet名称与WebFlow资源servlet的servlet名称冲突,因此您也需要解决此名称差异。

如中所述:

启用JSF2资源请求的处理。例如:

    <mvc:resources mapping="/resources/**" location="/"/>
    <faces:resources order="-1"/>
/webflow primefaces showcase/app/javax.faces.resource/jsf.js?ln=javax.faces

尝试将其添加到MVC配置中:

    <faces:resources/>

在声明了多个资源的某些情况下,还需要使用显式order属性。例如:

    <mvc:resources mapping="/resources/**" location="/"/>
    <faces:resources order="-1"/>

我为我的应用程序解决了这个问题

WEB-INF/config/webmvc config.xml中将订单0设置为mvc:resources

<mvc:resources order="0" location="/WEB-INF/web-content/" mapping="/WEB-INF/web-content/**"/>

然后在WEB-INF/config/webflow config.xml中,将FlowHandlerMappin的顺序值更改为更大的值:

<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping"> 
    <property name="order" value="2" /> 
    <property name="flowRegistry" ref="flowRegistry" /> 
</bean>


这就足够了,但我建议您也从web.xml中删除ResourceServlet,mvc不再需要它:resources

我部署在GlassFish 3.1 btw上,您的Spring dispatcher servlet映射在
/*
的URL模式上。因此,它将拦截每个URL,也包括CSS/JS/images/等。事实证明,dispatcher servlet不知道如何处理它们,因此它们只是被吞没,因此webbrowser无法获得任何CSS/JS/images,因此外观完全被破坏。顺便说一句,修复您的
web.xml
根声明以匹配Servlet 3.0 XSD,您有一个古老的Servlet 2.3 DTD声明,它将使所有内容都在Servlet 2.3兼容模式下运行。@BalusC-我尝试将URL模式从/*更改为*.do。然后,我将我的HomeController.java中的@RequestMapping从“/”更改为“home.do”,但当我尝试启动应用程序时,得到了以下结果---
警告:StandardWrapperValve[jsp]:PWC1406:Servlet.service()for Servlet jsp在org.springframework.faces.webflow.FlowViewStateManager.saveView抛出异常java.lang.NullPointerException(FlowViewStateManager.java:181)
——我肯定我缺少一些基础知识,所以我会继续阅读。你能提供的任何提示都会很好。感谢你的耐心。此外,我尝试了URL模式/而不是/*。该应用程序启动时带有一个非常类似的警告
警告:找不到具有URI的HTTP请求的映射[/client ui//javax.faces.resource/jquery/jquery.js]在名为'DispatcherMVC'的DispatcherServlet中
对不起,我不使用Spring,因此我无法给出这一部分的详细答案。顺便说一下,您的
web.xml
根声明仍然被破坏。由于Servlet 2.4是XSD,而不是DTD。给定PrimeFaces标记库URI,OP使用的是PF 3.x。资源Servlet仅用于PF 2.x。[[.我更新了我的代码和原始帖子
<mvc:resources order="0" location="/WEB-INF/web-content/" mapping="/WEB-INF/web-content/**"/>
    <faces:resources/>
    <mvc:resources mapping="/resources/**" location="/"/>
    <faces:resources order="-1"/>
<mvc:resources order="0" location="/WEB-INF/web-content/" mapping="/WEB-INF/web-content/**"/>
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping"> 
    <property name="order" value="2" /> 
    <property name="flowRegistry" ref="flowRegistry" /> 
</bean>