【发布时间】:2020-06-10 09:30:33
【问题描述】:
Spring-webflow 配置和视图重定向存在问题。
登录后,您应该进入配置的主页,但您会被重定向到错误页面。
查看log trace,确认登录中提交时,重定向到对应的视图,但是控制视图的spring组件出现错误,只允许jsp和jspx。
我们正在使用 Spring-webflow 2.4.1、Spring-mvc 3.1.4、jsf 2.2 和 primefaces 4.0。
我们一直在验证如何使用 xml 执行此操作的不同方法,因为它是一个旧应用程序,我们正在做的是从 ant 重构为 maven,以便继续进行所需的修改。
产生的错误如下:
11:15:32,603 信息 [stdout] (http-localhost/127.0.0.1:8080-5) 10-06-2020 11:15:32,602 [调试] [http-localhost/127.0.0.1:8080-5 ] [org.springframework.webflow.engine.impl.FlowExecutionImpl] 试图处理 [org.springframework.webflow.execution.FlowExecutionException: 异常在流 'start-flow' 的状态 'index' 中抛出] 根本原因 [java.lang .IllegalArgumentException: Unsupported view type /WEB-INF/index.xhtml 只有这个 FlowViewResolver 实现支持的类型是 [.jsp] 和 [.jspx]] 11:15:32,603 错误 [com.axa.ca.caem.web.core.exception.CaemExceptionHandler] (http-localhost/127.0.0.1:8080-5) 处理异常 11:15:32,603 信息 [stdout] (http-localhost/127.0.0.1:8080-5) 10-06-2020 11:15:32,603 [错误] [http-localhost/127.0.0.1:8080-5] [com .axa.ca.caem.web.core.exception.CaemExceptionHandler] 处理异常 11:15:32,604 错误 [com.axa.ca.caem.web.core.exception.CaemExceptionHandler] (http-localhost/127.0.0.1:8080-5) CaemExceptionHandler 中捕获的未知错误:java.lang.IllegalArgumentException : 不支持的视图类型 /WEB-INF/index.xhtml 仅此 FlowViewResolver 实现支持的类型是 [.jsp] 和 [.jspx] 在 org.springframework.webflow.mvc.builder.FlowResourceFlowViewResolver.getViewInternal(FlowResourceFlowViewResolver.java:94) [spring-webflow-2.4.1.RELEASE.jar:2.4.1.RELEASE]
配置文件有: spring-webflow.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:webflow="http://www.springframework.org/schema/webflow-config"
xmlns:faces="http://www.springframework.org/schema/faces"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/webflow-config
http://www.springframework.org/schema/webflow-config/spring-webflow-config.xsd
http://www.springframework.org/schema/faces http://www.springframework.org/schema/faces/spring-faces.xsd">
<faces:resources/>
<!-- Maps request paths to flows in the flowRegistry; localeChangeInterceptor
is used for intercepting internationalization changes -->
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
<property name="flowRegistry" ref="flowRegistry" />
<property name="interceptors">
<list>
<ref bean="localeChangeInterceptor"></ref>
</list>
</property>
<property name="order" value="0"/>
</bean>
<bean class="org.springframework.faces.webflow.JsfFlowHandlerAdapter">
<property name="flowExecutor" ref="flowExecutor" />
</bean>
<webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry">
<webflow:flow-execution-listeners>
<webflow:listener ref="facesContextListener"/>
<webflow:listener ref="securityListener"/>
</webflow:flow-execution-listeners>
</webflow:flow-executor>
<!-- Registramos todos nuestros flujos con la dupla id-xml -->
<webflow:flow-registry id="flowRegistry" base-path="/WEB-INF/flows">
<webflow:flow-location-pattern value="/**.xml" />
<webflow:flow-location id="parent-flow" path="parent-flow.xml" />
</webflow:flow-registry>
<webflow:flow-builder-services id="flowBuilderServices" />
<!-- Mapea a nombres logicos de vista to recursos fisicos -->
<!-- Maps logical view names to Facelet templates in /WEB-INF (e.g. 'search' to '/WEB-INF/search.xhtml' -->
<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>
<!-- A listener to create and release a FacesContext -->
<bean id="facesContextListener" class="org.springframework.faces.webflow.FlowFacesContextLifecycleListener"/>
</beans>
提前致谢。
【问题讨论】:
标签: spring jsf spring-webflow