Announcement Announcement Module
No announcement yet.
Help: Upconverting from Portlets to Servlets Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • rasperin
    started a topic Help: Upconverting from Portlets to Servlets

    Help: Upconverting from Portlets to Servlets

    I am having a horrible time trying to upconvert my project from a portlet to a servlet. I'm trying to minimize the code change as this project is complete (for the most part) just certain IBM components that were supposed to work with the portal server don't.

    As a background I am very new to webflow and have been learning it as I go on. We didn't use annotations in the initial release of this and at this point I'd rather avoid putting them in. We also use FormAction for our controllers to use, each portlet had it's own controller and then the main portlet would subflow the other portlets. Example:

    (Rather large but their is a benefit of showing it all)

    I have 5 of those named <appname>-portlet.xml each one invokes there own webflow, invokes there own form action, and holds it's own values.

    The hierarchy looks like this: View Controller subflows Enroll Controller which subflows 3 other controllers.

    How do I do this?
    Last edited by rasperin; Apr 13th, 2009, 02:14 PM.

  • rasperin
    I don't know how useful this will be, I tend to have a coherency issue when it comes to anything else then coding and casual conversation.

    I thought I'd reply to myself as I've finally up-converted from a Servlet to a Portlet. Basically the information you would have had in a *-portlet.xml is going to be switched to a *-servlet.xml. Oddly I had to also create a webflow-config.xml and import both of those from my application-config.xml (bean directory defined in your contextLoader), so anything I need to do I actually have to do in the webflow-config.xml but it doesnít work without the *-servlet.xml. If you have multiple portlet with multiple flows sub-flowing each other you are going to have to make multiple entries into your web.xml for each portlet. I switched from ViewRenderServlet to:

    The rest stayed the same.

    The only real tricky part about the conversion is the webmvc-config.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns=""
    		<!-- Enables annotated methods on POJO @Controllers  -->
    	<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/>
    	<!-- Enables plain Controllers (e.g. FlowController) -->
    	<bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter"/>
        <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
            <property name="interceptors" ref="localeChangeInterceptor"/>
    	<!-- Enables plain Controllers -->
        <bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" />
    	<!-- URL to flow mapping rules -->
    	<bean id="flowMappings" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    		<property name="mappings">
    		<property name="order" value="0" />
    	<bean name="/asdf.html" class="org.springframework.webflow.mvc.servlet.FlowController">
    	    <property name="flowExecutor" ref="flowExecutor" />
    	<bean id="ViewFlowHandler" class="com.ViewFlowHandler"/>
    	<bean id="messageSource" class="">
    		<property name="basenames">
        <!-- Declare the Interceptor -->
        <bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
            <property name="paramName" value="locale"/>
        <!-- Declare the Resolver -->
        <bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver" />    
    This is a huge addition and change up, take a good look through it most things are commented where they need to be.

    When you go to deploy this, you are going to run http://serverName/deployedLocation/asdf.html and it should load your Controller if you built your beans correctly. Thatís about the gist of it, the rest I was able to easily port over. Iím now trying to figure out this whole attribute mapping in subflow thing.

    Leave a comment:

  • rasperin
    I hate to bump, but I'm really in need of help, if anyone knows anything. A link to point me in the right direction.

    Mostly what I need is to see how a Servlet handles multiple Webflows that can run stand alone without using annotations. I've seen it for SWF 1.


    Leave a comment: