Announcement Announcement Module
Collapse
No announcement yet.
Spring MVC + Web Flow - Issues Resolving Views Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring MVC + Web Flow - Issues Resolving Views

    I am attempting to build a Spring MVC + Web Flow + Apache Tiles2 application.

    I am having an issue when I run the application where the JSP code is displayed on the client-end instead of an HTML rendered page. When viewing the source of the rendered page, I get everything including any java code and comments. Google chrome shows the source. Internet Explorer 8 shows a partially rendered HTML page.

    I am leaning towards something is wrong with my View Resolver configuration.

    My goal is to be able to call Web Flows like any other URL. For Example:
    Code:
    <a href="register-flow">Register</a>
    
    <!-- as opposed to -->
    <a href="fc.go?_flowId=register-flow">Register</a>
    And I'd like to be able to use Annotated Controllers for MVC pages.

    IDE => Eclipse Indigo
    Application Server => Tomcat 6
    Java 1.6 update 32

    Here are the libraries I have included in the project:
    • antlr-2.7.6
    • asm
    • asm-attrs
    • cglib-2.1.3
    • commons-beanutils-1.8.0
    • commons-collections-2.1.1
    • commons-collections-3.1
    • commons-digester-1.8.1
    • commons-logging-1.1.1
    • dom4j-1.6.1
    • ehcache-1.2.3
    • ejb3-persistence
    • hibernate3
    • hibernate-annotations
    • hibernate-commons-annotations
    • hibernate-entitymanager
    • hibernate-tools
    • javassist
    • jdbc2_0_stdext
    • jstl
    • jta
    • jtidy-r8-20060801
    • ojbdbc6
    • org.apache.commons.logging_1.1.1
    • org.springframework.aop-3.1.1.RELEASE
    • org.springframework.asm-3.1.1.RELEASE
    • org.springframework.aspects-3.1.1.RELEASE
    • org.springframework.beans-3.1.1.RELEASE
    • org.springframework.binding-2.3.1.RELEASE
    • org.springframework.context.support-3.1.1.RELEASE
    • org.springframework.context-3.1.1.RELEASE
    • org.springframework.core-3.1.1.RELEASE
    • org.springframework.expression-3.1.1.RELEASE
    • org.springframework.faces-2.3.1.RELEASE
    • org.springframework.instrument.tomcat-3.1.1.RELEASE
    • org.springframework.instrument-3.1.1.RELEASE
    • org.springframework.jdbc-3.1.1.RELEASE
    • org.springframework.jsm-3.1.1.RELEASE
    • org.springframework.js.resources-2.3.1.RELEASE
    • org.springframework.js-2.3.1.RELEASE
    • org.springframework.orm-3.1.1.RELEASE
    • org.springframework.oxm-3.1.1.RELEASE
    • org.springframework.spring-library-3.1.1.RELEASE
    • org.springframework.test-3.1.1.RELEASE
    • org.springframework.transaction-3.1.1.RELEASE
    • org.springframework.web.portlet-3.1.1.RELEASE
    • org.springframework.servlet-3.1.1.RELEASE
    • org.springframework.struts-3.1.1.RELEASE
    • org.springframework.web-3.1.1.RELEASE
    • org.springframework.webflow-2.3.1.RELEASE
    • standard
    • tiles-api-2.1.3
    • tiles-core-2.1.3
    • tiles-jsp-2.1.3
    • tiles-servlet-2.1.3

    This is my web.xml configuration:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
       <display-name>springMvcWebflow</display-name>
       
       <listener>
            <listener-class>
                org.springframework.web.context.ContextLoaderListener
            </listener-class>
        </listener>
            
        <servlet>
            <servlet-name>springMvcWebflow</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <init-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>
                    /WEB-INF/config/*servlet.xml
                </param-value>
            </init-param>    
            <load-on-startup>1</load-on-startup>
        </servlet>
    
        <servlet-mapping>
            <servlet-name>springMvcWebflow</servlet-name>
            <url-pattern>/*</url-pattern>
        </servlet-mapping>
        
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        
        <welcome-file-list>
            <welcome-file>/WEB-INF/jsp/redirect.jsp</welcome-file>
        </welcome-file-list>
        
    </web-app>
    My applicationContext.xml is blank, but I have other spring configuration files for MVC and Web Flow individually:

    Here is the mvc-servlet.xml:
    Code:
    <?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:mvc="http://www.springframework.org/schema/mvc"
           xmlns:context="http://www.springframework.org/schema/context"
           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/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
           http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
            
           <context:component-scan base-package="com.bso" />
    
    	<mvc:annotation-driven />
    	
    	<mvc:default-servlet-handler />
    	
    	<mvc:view-controller path="/" view-name="redirect" />
    	
        <bean id="mvcDefaultViewResolver"
              class="org.springframework.web.servlet.view.UrlBasedViewResolver"
              p:viewClass="org.springframework.web.servlet.view.tiles2.TilesView"
        />
        
        <bean class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
        	<property name="definitions" value="/WEB-INF/**/tiles.xml" />
    	</bean>
    	
    	
    
    </beans>
    Here is my webflow-servlet.xml:
    Code:
    <?xml version="1.0" encoding="windows-1252" ?>
    <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"
           xsi:schemaLocation="
                           http://www.springframework.org/schema/beans
                           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                           http://www.springframework.org/schema/webflow-config
                           http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.3.xsd">	
      			
        <webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry">
        	<webflow:flow-execution-repository max-executions="5" max-execution-snapshots="30" />
        </webflow:flow-executor>
      
        <webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices" base-path="/WEB-INF/pageFlows">
            <webflow:flow-location-pattern value="/**/*-flow.xml" />
        </webflow:flow-registry>	  	
        
        <webflow:flow-builder-services id="flowBuilderServices" view-factory-creator="mvcViewFactoryCreator"/>
        
        <bean id="mvcViewFactoryCreator" class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator" />
        
        <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter">
        	<property name="flowExecutor" ref="flowExecutor" />
    	</bean>
    	
    	<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
        	<property name="flowRegistry" ref="flowRegistry"/>
        	<property name="order" value="-1"/>
    	</bean>
        
          		
    </beans>
    Here is a screenshot of my application architecture:
    Attachment

    Here is a screenshot of Google Chrome showing the JSP code instead of a rendered HTML page:
    Attachment
    Attached Files
Working...
X