View Full Version : Can any one help me out in integrating spring MVC & Web
nlatha
Aug 12th, 2005, 10:39 AM
Hi,
Can any one help me out in integrating spring MVC & Webflow? Is there any info regarding this? We are using spring framework in our current project. I am new to this spring framework.
I created Spring MVC, Spring webflow separately and able to run successfully. Now I want to merge both.
Initially, I have two xml files as follows:
SampleWebFlow-servlet.xml for Spring MVC
Servlet.xml for Spring webflow
While I am integrating MVC and WEBFLOW, I configured SampleWebFlow-servlet.xml & Servlet.xml in web.xml.
In this case I’m able to access only one application (I guess it’s overriding servlet.xml). So I merged two files into a single servlet.xml file and then I am trying to access the application.
For my MVC URL path is /SampleWebFlow/index.toc
And for WEBFLOW /SampleWEBFlow/journal.toc
I am able to access only /SampleWebFlow/index.toc not journal.toc
Am I missing any thing?
klr8
Aug 12th, 2005, 10:47 AM
I'm guessing you only have 1 dispatcher servlet in your web.xml file that is reading the merged context XML file.
First thing to check is that dispatcher servlet is correctly passed the requests you're sending. If not, check the mapping in web.xml.
If the dispatcher servlet correctly receives the requests, check the ViewResolver defined in the application context XML to see if the dispatcher servlet can correctly locate the controller handling "journal.toc".
For more info on all of this, check the Spring MVC reference docs: http://static.springframework.org/spring/docs/1.2.x/reference/mvc.html.
Erwin
nlatha
Aug 12th, 2005, 11:12 AM
Hi Erwin,
I am really thankful to you for the quick response.
I have 1 dispatcher servlet in my web.xml.
<servlet>
<servlet-name>SampleWebFlow</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:org/springframework/webflow/samples/journal/deploy/journal-layer.xml
classpath:org/springframework/webflow/samples/journal/deploy/volume-layer.xml
/WEB-INF/SampleWebFlow-servlet.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>SampleWebFlow</servlet-name>
<url-pattern>*.toc</url-pattern>
</servlet-mapping>
My SampleWebFlow-servlet.xml contains the following configuration details:
<beans>
<bean name="/journal.toc" class="org.springframework.webflow.mvc.FlowController">
<!--
Set cacheSeconds to a small, non 0, value so you can do ctrl-N to open an new
window and experiment with the continuations stuff.
-->
<property name="cacheSeconds" value="5"/>
<property name="flowExecutionManager" ref="flowExecutionManager"/>
</bean>
<!--
Custom configuration of the HTTP request flow execution manager.
Note how you can just change the flow execution storage strategy without any impact
on the views!
-->
<bean id="flowExecutionManager" class="org.springframework.webflow.execution.servlet.Serv letFlowExecutionManager">
<property name="listener">
<bean class="org.springframework.webflow.samples.journal.web.Jo urnalFlowExecutionListener"/>
</property>
<property name="storage">
<bean class="org.springframework.webflow.execution.servlet.Http SessionContinuationFlowExecutionStorage"/>
</property>
<!--
<property name="storage">
<bean class="org.springframework.webflow.execution.servlet.Http SessionFlowExecutionStorage"/>
</property>
-->
<!--
<property name="storage">
<bean class="org.springframework.webflow.execution.ClientContin uationFlowExecutionStorage">
<property name="compress" value="true"/>
</bean>
</property>
-->
</bean>
<bean id="statisticsService" class="org.springframework.webflow.execution.jmx.Statisti csService">
<constructor-arg ref="flowExecutionManager"/>
<property name="enabled" value="true"/>
</bean>
<bean id="demoController" class="DemoController"/>
<bean id="flowURLMapping" class="org.springframework.web.servlet.handler.SimpleUrlH andlerMapping">
<property name="mappings">
<props>
<prop key="/index.toc">paramMultiController</prop>
</props>
</property>
</bean>
<bean id="propsResolver" class="org.springframework.web.servlet.mvc.multiaction.Pr opertiesMethodNameResolver">
<property name="mappings">
<props>
<prop key="/index.toc">initialRequest</prop>
</props>
</property>
</bean>
<bean id="paramMultiController" class="org.springframework.web.servlet.mvc.multiaction.Mu ltiActionController">
<property name="methodNameResolver"><ref bean="propsResolver"/></property>
<property name="delegate"><ref bean="demoController"/></property>
</bean>
<bean id="urlFileNameController" class="org.springframework.web.servlet.mvc.UrlFilenameVie wController"/>
<bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResou rceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>
</beans>
Is the above configuration file correct? Am I doing anything wrong?
Journal.toc is for webflow.
nlatha
Aug 12th, 2005, 12:36 PM
Hi Erwin,
I am sorry, I made mistake in web.xml. I solve the problem.
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.