chaitu chaitu
asked on
how to execute spring webflow 1.0 version flows from jsp
When i click proceed link it will check the id(letterPrinting) mentioned in flow-config.xml and executed the flows(execute the first flow i.e.enterPersonalDetails) in printLetter.xml.
its working fine in spring web flow 2.0;
In spring web flow 1.0 id attribute was not there in printLetter.xml then how to execute the flows in 1.0 version when i click proceed link in jsp?
its working fine in spring web flow 2.0;
In spring web flow 1.0 id attribute was not there in printLetter.xml then how to execute the flows in 1.0 version when i click proceed link in jsp?
index.jsp
*********
<body>
<a href="app/letterPrinting">Proceed.</a> <br>
</body>
flow-config.xml
****************
<webflow:flow-registry id="flowRegistry" base-path="/WEB-INF">
<webflow:flow-location path="/flows/letterPrinting/printLetter.xml" id="letterPrinting" />
</webflow:flow-registry>
printLetter.xml
***************
<?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">
<view-state id="enterPersonalDetails">
<transition on="next" to="enterCustomMessage"/>
</view-state>
</flow>
ASKER
web flow 1.0 version i am using.we cannot use id attribute in version 1.0 so how to execute flows from index.jsp..
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.co ntext.Cont extLoaderL istener
Throwable occurred: org.springframework.beans. factory.xm l.XmlBeanD efinitionS toreExcept ion: Line 26 in XML document from ServletContext resource [/flows/letterPrinting/pri ntLetter.x ml] is invalid; nested exception is org.xml.sax.SAXParseExcept ion: cvc-complex-type.3.2.2: Attribute 'id' is not allowed to appear in element 'flow:location'.
Caused by: org.xml.sax.SAXParseExcept ion: cvc-complex-type.3.2.2: Attribute 'id' is not allowed to appear in element 'flow:location'.
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.co
Throwable occurred: org.springframework.beans.
Caused by: org.xml.sax.SAXParseExcept
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:flow="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-1.0.xsd">
<bean name="/*" class="org.springframework.webflow.executor.mvc.FlowController">
<property name="flowExecutor" ref="flowExecutor" />
<property name="defaultFlowId" value="/flows/letterPrinting/printLetter.xml" />
</bean>
<!-- Launches new flow executions and resumes existing executions. -->
<flow:executor id="flowExecutor" registry-ref="flowRegistry">
<flow:execution-attributes>
<flow:alwaysRedirectOnPause value="false" />
</flow:execution-attributes>
</flow:executor>
<!-- Creates the registry of flow definitions for this application -->
<flow:registry id="flowRegistry">
<flow:location path="/flows/letterPrinting/printLetter.xml" id="main"/>
</flow:registry>
</beans>
I think it uses the filename as the id, in your case it would use 'printLetter'
ASKER
now i changed hyper link action
index.jsp
*******
<a href="app/printLetter">Pro ceed</a>
when i hit this
HTTP Status 404 - /app/printLetter
index.jsp
*******
<a href="app/printLetter">Pro
when i hit this
HTTP Status 404 - /app/printLetter
1.0 looks for the id as a parameter by default
Try adding a RequestPathFlowExecutorArg umentHandl er to your controller
<bean name="/*" class="org.springframework .webflow.e xecutor.mv c.FlowCont roller">
<property name="flowExecutor" ref="flowExecutor"/>
<property name="argumentHandler">
<bean class="org.springframework .webflow.e xecutor.su pport.Requ estPathFlo wExecutorA rgumentHan dler"/>
</property>
</bean>
Try adding a RequestPathFlowExecutorArg
<bean name="/*" class="org.springframework
<property name="flowExecutor" ref="flowExecutor"/>
<property name="argumentHandler">
<bean class="org.springframework
</property>
</bean>
ASKER
still same error.
index.jsp
********
<a href="/app/printLetter">Pr
flow-config.xml
*****************
<bean name="/*" class="org.springframework.webflow.executor.mvc.FlowController">
<property name="flowExecutor" ref="flowExecutor" />
<property name="argumentHandler">
<bean class="org.springframework.webflow.executor.support.RequestPathFlowExecutorArgumentHandler"/>
</property>
</bean>
<!-- Launches new flow executions and resumes existing executions. -->
<flow:executor id="flowExecutor" registry-ref="flowRegistry">
<flow:execution-attributes>
<flow:alwaysRedirectOnPause value="false" />
</flow:execution-attributes>
</flow:executor>
<!-- Creates the registry of flow definitions for this application -->
<flow:registry id="flowRegistry">
<flow:location path="/flows/letterPrinting/printLetter.xml" />
</flow:registry>
Can you check your path ....
path="/WEB-INF//flows/lett erPrinting /printLett er.xml" try this ...
path="/WEB-INF//flows/lett
> <bean name="/*" class="org.springframework .webflow.e xecutor.mv c.FlowCont roller">
try mapping it to a specific path instead of the wildcard
try mapping it to a specific path instead of the wildcard
ASKER
in which jar this class wil be located?i need spring webflow 1.0 version combatability jars..
am getting following error now.
java.lang.ClassNotFoundExc eption: org.springframework.contex t.event.So urceFilter ingListene r
am getting following error now.
java.lang.ClassNotFoundExc
what did you change?
ASKER
changed to specific path after that i am getting this exception.
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:flow="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-1.0.xsd">
<bean name="/app/" class="org.springframework .webflow.e xecutor.mv c.FlowCont roller">
<property name="flowExecutor" ref="flowExecutor" />
<property name="defaultFlowId" value="/flows/letterPrinti ng/printLe tter.xml" />
</bean>
</beans>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:flow="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-1.0.xsd">
<bean name="/app/" class="org.springframework
<property name="flowExecutor" ref="flowExecutor" />
<property name="defaultFlowId" value="/flows/letterPrinti
</bean>
</beans>
> changed to specific path after that i am getting this exception.
great, that would suggest you're getting closer.
Did you see my previous comment? You need to make sure all your jar are comparible as well.
Migrating from 2.x to 1.x isn't trivial btw, there are quite a few changes between versions.
great, that would suggest you're getting closer.
Did you see my previous comment? You need to make sure all your jar are comparible as well.
Migrating from 2.x to 1.x isn't trivial btw, there are quite a few changes between versions.
ASKER
now i am getting this error.
SEVERE: Servlet.service() for servlet spring threw exception
org.springframework.webflo w.definiti on.registr y.NoSuchFl owDefiniti onExceptio n: No such flow definition with id '/WEB-INF/flows/letterPrin ting/print Letter.xml ' found; the flows available are: array<String>['printLetter ']
index.jsp
**********
<a href="app/printLetter">Pro ceed</a>
web.xml
*********
SEVERE: Servlet.service() for servlet spring threw exception
org.springframework.webflo
index.jsp
**********
<a href="app/printLetter">Pro
web.xml
*********
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/app/*</url-pattern>
</servlet-mapping>
where is printLetter.xml?
ASKER
in this path(/WEB-INF/flows/letter Printing/p rintLetter .xml.
) only.same code has worked in spring 2.0 version because we have id attribute in 2.0 so spring is able to identify if i hit with app/letterPrinting.but in 1.0 version how to execute these flows i am not able to understand.
<webflow:flow-registry id="flowRegistry" base-path="/WEB-INF">
<webflow:flow-location path="/flows/letterPrintin g/printLet ter.xml" id="letterPrinting" />
</webflow:flow-registry>
) only.same code has worked in spring 2.0 version because we have id attribute in 2.0 so spring is able to identify if i hit with app/letterPrinting.but in 1.0 version how to execute these flows i am not able to understand.
<webflow:flow-registry id="flowRegistry" base-path="/WEB-INF">
<webflow:flow-location path="/flows/letterPrintin
</webflow:flow-registry>
see my earlier comment regards id's
ASKER
i am facing another problem now.
am executing flow like this.when i click proceed link its going to sample.jsp.but in this jsp ${flowExecutionUrl} is not coming.where am i missing??
http://localhost:8080/&event_Id=proceed.
its framing like this..
below jars hav placed in classpath.
commons-logging-1.0.4.jar
jdom-1.0.jar
ognl-2.6.11.jar
spring-2.0.2.jar
spring-mock-1.1.3.jar
spring-webflow-1.0.5.jar
am executing flow like this.when i click proceed link its going to sample.jsp.but in this jsp ${flowExecutionUrl} is not coming.where am i missing??
http://localhost:8080/&event_Id=proceed.
its framing like this..
below jars hav placed in classpath.
commons-logging-1.0.4.jar
jdom-1.0.jar
ognl-2.6.11.jar
spring-2.0.2.jar
spring-mock-1.1.3.jar
spring-webflow-1.0.5.jar
index.jsp
***********
<a href="app?_flowId=sample-flow">Proceed</a>
sample.jsp
*************
<%@ page isELIgnored="false" %>
<html>
<head>
<title>Insert title here</title>
</head>
<body>
<form id="frm">
<a href='${flowExecutionUrl}&_eventId=proceed'>Proceed-sample</a>
</form>
</body>
</html>
web.xml
********
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/app/*</url-pattern>
</servlet-mapping>
webflow-confi.xml
******************
<?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:flow="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-1.0.xsd">
<bean name="/*" class="org.springframework.webflow.executor.mvc.FlowController">
<property name="flowExecutor" ref="flowExecutor" />
</bean>
<!-- Launches new flow executions and resumes existing executions. -->
<flow:executor id="flowExecutor" registry-ref="flowRegistry">
<flow:execution-attributes>
<flow:alwaysRedirectOnPause value="false" />
</flow:execution-attributes>
</flow:executor>
<!-- Creates the registry of flow definitions for this application -->
<flow:registry id="flowRegistry">
<flow:location path="/WEB-INF/**-flow.xml" />
</flow:registry>
<bean id="saveAction" class="com.actions.SaveAction">
</bean>
</beans>
sample-flow.XML
*******************
<?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-1.0.xsd">
<start-state idref="example" />
<view-state id="example" view="sample">
<transition on="proceed" to="save"/>
</view-state>
<action-state id="save">
<action bean="saveAction" method="generateCode" />
<transition on="success" to="thanku" />
</action-state>
<view-state id="thanku" view='thanku'/>
</flow>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
so in 1.0 instead of flowExecutionUrl what should i use??
don't know you may have to construct the url manually
ASKER
i found out the solution.
you should use _flowExecutionKey=${flowEx ecutionKey } in spring 1.x
you should use _flowExecutionKey=${flowEx
sorry, don't understand what you mean. Can you explain?
http://static.springsource.org/spring-webflow/docs/1.0.x/reference/flow-definition.html