bonjour
Celà fait quelques jours que j'essaie de faire tourner cette petite appli pour tester SWF
J'utilise Eclipse 3.3 Europa, Tomcat 5.5 , JSTL 1.2, Spring 2.0 et Web Flow 2.0
J'ai cette exception:
java.lang.IllegalArgumentException: The requestPathInfo is null: unable to extract flow definition id or flow execution key
toute mon application:
web.xml:
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
| <?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Z9: Test</display-name>
<servlet>
<servlet-name>z9</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/z9-servlet.xml
/WEB-INF/z9-webflow.xml
</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>z9</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<listener>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app> |
z9-servlet:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| <?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:web="http://www.springframework.org/schema/webflow-config"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass">
<value>org.springframework.web.servlet.view.JstlView</value>
</property>
<property name="prefix">
<value>view/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
</beans> |
z9-webflow:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| <?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:web="http://www.springframework.org/schema/webflow-config"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/webflow-config
http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd">
<bean name="/main.htm" id="flowController" class="org.springframework.webflow.mvc.FlowController">
<property name="flowExecutor" ref="flowExecutor" />
</bean>
<web:flow-executor id="flowExecutor" flow-registry="flowRegistry"/>
<web:flow-registry id="flowRegistry" >
<web:flow-location path="/WEB-INF/flows/main-flow.xml" />
</web:flow-registry>
</beans> |
main-flow.xml:
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"?>
<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="operation" class="model.OperationsCommand" scope="flow" />
<start-state idref="displayMain"/>
<view-state id="displayMain" view="main">
<render-actions>
<action bean="formAction" method="setupForm"/>
</render-actions>
<transition on="submit" to="finish">
<action bean="formAction" method="bindAndValidate">
<attribute name="validatorMethod" value="validate"/>
</action>
</transition>
</view-state>
<end-state id="finish" view="success">
</end-state>
<import resource="main-beans.xml"/>
</flow> |
main-beans.xml:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| <?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:web="http://www.springframework.org/schema/webflow-config"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="formAction" class="org.springframework.webflow.action.FormAction">
<property name="formObjectName" value="operation"/>
<property name="validator">
<bean class="model.OperationsCommandValidator"/>
</property>
</bean>
</beans> |
main.jsp:
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
| <%@ include file="/view/include.jsp"%>
<%@ page language="java" contentType="text/html; charset=utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
</head>
<body>
<form:form commandName="operation">
<div>
<div id="TypeOperationChoose" class="ColumsCommon" >
<div>Afficher: <form:radiobutton path="choiceOperations" value="afficher"/></div>
<div> Ajouter: <form:radiobutton path="choiceOperations" value="ajouter"/></div>
<div> Modifier: <form:radiobutton path="choiceOperations" value="modifier"/></div>
<div> Effacer: <form:radiobutton path="choiceOperations" value="effacer"/></div>
<div> <form:errors path="choiceOperations" cssClass="error" /></div>
</div>
<div class="Submit" class="ColumsCommon" align="center" >
<input class="SubmitButton" type="submit" name="_eventId_submit" value="Submit" />
</div>
</div>
</form:form>
</body>
</html> |
if I understood correctly, with WebFlow 2.0, no more need to have the hidden input for the flowExecutionKey
but anyway, I tried also with this:
<input type="hidden" name="_flowExecutionKey" value="<c:out value='${flowExecutionKey}'>"/>
and it dont work too
OperationsCommand:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| package model;
public class OperationsCommand {
private String choiceOperations;
public String getChoiceOperations() {
return choiceOperations;
}
public void setChoiceOperations(String choiceOperations) {
this.choiceOperations = choiceOperations;
}
} |
OperationsCommandValidator:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| package model;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;
public class OperationsCommandValidator implements Validator {
public void validate(Object obj, Errors errors) {
ValidationUtils.rejectIfEmpty(errors, "choiceOperations", "required","required.");
}
public boolean supports(Class clazz) {
return clazz.equals(OperationsCommand.class);
}
} |
merci d'avance
Partager