views:

51

answers:

0

In my portlet application I have a spring SimpleFormController with a HandleRenderedRequestInternal method that is called when the page loads.

On submitting a form I want the OnSubmitAction to be called and then the HandleRenderedRequestInternal to be called.

Is this possible? At the moment when I submit a form it is going into handleRenderedRequestInternal and not onSubmitAction.

Here is my code

protected ModelAndView retrieveCommunications() {
    List<Communication> communications = c dao.getAllCommunications();
    return new ModelAndView("communications/communicationsAdmin", "model", communications);
}


@Override
protected ModelAndView handleRenderRequestInternal(RenderRequest arg0, RenderResponse arg1) throws Exception {
    return retrieveCommunications();
}


@SuppressWarnings("unchecked")
@Override
protected void onSubmitAction(ActionRequest argRequest, ActionResponse argResponse, Object command, BindException errors) throws Exception {
    //process form here
}


<bean id="communicationsDao" class="com.fmr.admin.portlet.communication.dao.impl.HibernateCommunicationsDAOImpl">
    <property name="sessionFactory">
        <ref local="communicationsSessionFactory" />
    </property>
</bean>

<bean id="communicationsValidator" class="com.fmr.admin.portlet.communication.CommunicationsValidator"/>

<bean id="communicationsController" class="com.fmr.admin.portlet.communication.CommunicationsAdminController">
    <property name="commandName" value="communications"/>
    <property name="commandClass" value="com.fmr.admin.portlet.communication.vo.Communication"/>
    <property name="formView" value="communications/communicationsAdmin"/>
    <property name="successView" value="communications/communicationsAdmin"/>
    <property name="validator"><ref bean="communicationsValidator"/></property>
    <property name="dao"><ref bean="communicationsDao"/></property>
</bean>

<bean id="portletModeHandlerMapping" class="org.springframework.web.portlet.handler.PortletModeHandlerMapping">
    <property name="order" value="1"/>
    <property name="portletModeMap">
        <map>
            <entry key="view"><ref bean="communicationsController"/></entry>
        </map>
    </property>
</bean>

Thanks in advance