Bonjour,

Je voudrais utiliser le bean InternalResourceViewResolver pour "résoudre" les vues définies dans le web flow...

web.xml:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" 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_3_0.xsd">
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/applicationContext.xml</param-value>
    </context-param>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <servlet>
        <servlet-name>mailview</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>mailview</servlet-name>
        <url-pattern>*.htm</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>redirect.jsp</welcome-file>
    </welcome-file-list>
</web-app>
redirect.jsp:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
 
<%--
Views should be stored under the WEB-INF folder so that
they are not accessible except through controller process.
 
This JSP is here to provide a redirect to the dispatcher
servlet but should be the only JSP outside of WEB-INF.
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<% response.sendRedirect("homeView.htm"); %>
mailview-servlet.xml:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
 
<?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:p="http://www.springframework.org/schema/p"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:webflow="http://www.springframework.org/schema/webflow-config"        
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
       http://www.springframework.org/schema/webflow-config http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd">
 
    <bean id="mailItemsViewSerice" class="be.services2actions.spring.webflow.mailview.MailItemModel" />
    <!--
    Most controllers will use the ControllerClassNameHandlerMapping above, but
    for the index controller we are using ParameterizableViewController, so we must
    define an explicit mapping for it.
    -->
 
    <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="mappings">
            <props>
                <prop key="homeView.htm">flowController</prop>
            </props>
        </property>
    </bean>
 
    <webflow:flow-registry id="flowRegistry" >
        <webflow:flow-location id="homeView" path="/WEB-INF/flows/mailViewFlow.xml" />
    </webflow:flow-registry>
 
    <bean id="flowController" class="org.springframework.webflow.mvc.servlet.FlowController">
        <property name="flowExecutor" ref="flowExecutor" />
    </bean>
 
    <webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry">
    </webflow:flow-executor>
 
    <bean id="viewResolver"
          class="org.springframework.web.servlet.view.InternalResourceViewResolver"
          p:prefix="/WEB-INF/jsp/"
          p:viewClass="org.springframework.web.servlet.view.JstlView"
           />
 
</beans>
mailViewFlow.xml:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
<flow xmlns="http://www.springframework.org/schema/webflow"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/webflow
        http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">
 
    <var name="mailItemModel" class="be.services2actions.spring.webflow.mailview.MailItemModel"/>
 
    <view-state id="homeView" model="mailItemModel" view="homeView.jspx">
        <transition on="viewMailItems" to="viewMailItemsAction" />
    </view-state>
 
    <action-state id="viewMailItemsAction">        
        <evaluate expression="mailItemsViewService.isUserValid(mailItemModel.username)" result="flowScope.isValidUser" />
        <transition to="checkValidUser" />
    </action-state>
 
    <decision-state id="checkValidUser">
        <if test="flowScope.isValidUser" then="getMailItems" else="invalidUserView"/>
    </decision-state>
 
    <action-state id="getMailItems">
        <evaluate expression="mailItemsViewService.retriveMailItems(mailItemModel.username)" result="flowScope.mailItems" />
        <transition to="validUserView" />
    </action-state>
 
    <end-state id="validUserView" view="/jsp/mailItemsView.jspx"/>
 
    <end-state id="invalidUserView" view="/jsp/invalidUserView.jspx" />
 
</flow>
Donc ce que je voudrais c'est que lorsque je définis la vue homeView.jspx:
<view-state id="homeView" model="mailItemModel" view="homeView.jspx">

Grâce aux resolver de vue, il sache qu'il trouvera la vue dans:
/WEB-INF/jsp/homeView.jspx

Et bien évidement ca ne fonctionne pas...