SpringWebFlow+;MVC资源映射
我正在尝试使用SpringMVC、webflow和primefaces制作一个示例项目。 以下是我的部署描述符(web.xml):SpringWebFlow+;MVC资源映射,spring,spring-mvc,primefaces,mapping,spring-webflow,Spring,Spring Mvc,Primefaces,Mapping,Spring Webflow,我正在尝试使用SpringMVC、webflow和primefaces制作一个示例项目。 以下是我的部署描述符(web.xml): TestMVC /应用程序/测试类 log4jConfigLocation log4j.properties log4jExposeWebAppRoot 错误的 上下文配置位置 /WEB-INF/applicationContext.xml org.springframework.web.util.Log4jConfigListener org.springfra
TestMVC
/应用程序/测试类
log4jConfigLocation
log4j.properties
log4jExposeWebAppRoot
错误的
上下文配置位置
/WEB-INF/applicationContext.xml
org.springframework.web.util.Log4jConfigListener
org.springframework.web.context.ContextLoaderListener
com.sun.faces.config.ConfigureListener
javax.faces.DEFAULT_后缀
.xhtml
javax.faces.PROJECT_阶段
发展
javax.faces.FACELETS\u刷新\u周期
1.
Facesservlet
javax.faces.webapp.FacesServlet
1.
Facesservlet
*.面孔
appServlet
org.springframework.web.servlet.DispatcherServlet
上下文配置位置
/WEB-INF/servlet-context.xml
1.
appServlet
/应用程序/*
MVC servlet上下文:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:oxm="http://www.springframework.org/schema/oxm"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:webflow-config="http://www.springframework.org/schema/webflow-config"
xmlns:faces="http://www.springframework.org/schema/faces"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.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/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.2.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/faces http://www.springframework.org/schema/faces/spring-faces-2.2.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">
<bean id="facesContextListener" class="org.springframework.faces.webflow.FlowFacesContextLifecycleListener" />
<webflow-config:flow-executor id="flowExecutor">
<webflow-config:flow-execution-listeners>
<webflow-config:listener ref="facesContextListener"/>
</webflow-config:flow-execution-listeners>
</webflow-config:flow-executor>
<faces:flow-builder-services id="flowBuilderServices"/>
<webflow-config:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices" base-path="/WEB-INF/flows">
<webflow-config:flow-location-pattern value="/**/flow.xml"/>
</webflow-config:flow-registry>
<mvc:annotation-driven />
<mvc:resources location="/, classpath:/META-INF/resources/primefaces/, classpath:/META-INF/resources/primefaces-aristo/" mapping="/javax.faces.resource/**"/>
<context:component-scan base-package="ru.test.controller" />
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
<property name="flowRegistry" ref="flowRegistry" />
</bean>
<bean class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.faces.mvc.JsfView" />
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".xhtml" />
</bean>
<bean class="org.springframework.faces.webflow.JsfFlowHandlerAdapter">
<property name="flowExecutor" ref="flowExecutor" />
</bean>
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource" p:basenames="WEB-INF/i18n/messages,WEB-INF/i18n/application" p:fallbackToSystemLocale="false" />
</beans>
我的问题是——进行这样的映射是否正确:
<mvc:resources location="/, classpath:/META-INF/resources/primefaces/, classpath:/META-INF/resources/primefaces-aristo/" mapping="/javax.faces.resource/**"/>
在MVCServlet上下文中,还是我做错了什么?在《Pro SPRING 3》一书中的示例中没有这样的映射,但是如果我删除它,我将收到一个错误,比如DispatcherServlet中的“../javax.faces.resource/theme.css”没有找到映射等等。
我认为我添加映射的方法是错误的,因为我看不到primefaces/images中的图像
图书馆的版本包括:
弹簧面和webflow:2.3.0.0版本
SpringWebMVC:3.2.3.0版本
Primefaces:4.0
JSFAPI和jsf impl:2.0.11
提前谢谢
更新:
我自己找到了答案。我使用的方法是错误的,标记mvc:resources用于本地资源映射,用于映射需要添加的JSF资源
<faces:resources/>
进入MVCServlet上下文。使用pom.xml
used pom.xml
<dependency>
<groupId>org.springframework.webflow</groupId>
<artifactId>spring-js</artifactId>
<version>2.4.0.RELEASE</version>
</dependency>
and
<mvc:resources mapping="/web-resources/**/" location="/"/>
org.springframework.webflow
spring js
2.4.0.1发布
和
used pom.xml
<dependency>
<groupId>org.springframework.webflow</groupId>
<artifactId>spring-js</artifactId>
<version>2.4.0.RELEASE</version>
</dependency>
and
<mvc:resources mapping="/web-resources/**/" location="/"/>