Supporting custom portlet mode in Spring Portlet MVC Framework

In the Supporting Multiple modes with Spring Portlet MVC Framework, entry i built a sample portlet to demonstrate how you can support more than one portlet mode in Spring Portlet MVC Framework portlet. I changed that sample to see what it will take to add support for custom portlet mode in Spring Portlet MVC Framework portlet.

First i had to add a new Controller class that will get called whenever this portlet gets invoked int the config mode, like this

package com.webspherenotes.mvc.spring.action;

import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;

import org.springframework.web.portlet.ModelAndView;
import org.springframework.web.portlet.mvc.AbstractController;

public class ConfigController extends AbstractController{

public ModelAndView handleRenderRequest(RenderRequest request,
RenderResponse response) throws Exception {
System.out.println("Entering ConfigController.handleRenderRequest()");
ModelAndView modelAndView = new ModelAndView("config");
System.out.println("Exiting ConfigController.handleRenderRequest()");
return modelAndView;


Then i had to change the MultipleModesPortlet-portlet.xml, spring configuration file for the portlet like this

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
<bean id="viewController"
class="com.webspherenotes.mvc.spring.action.ViewController" />

<bean id="editController"
class="com.webspherenotes.mvc.spring.action.EditController" />

<bean id="helpController"
class="com.webspherenotes.mvc.spring.action.HelpController" />

<bean id="configController"
class="com.webspherenotes.mvc.spring.action.ConfigController" />

<bean id="portletModeHandlerMapping"
<property name="order" value="1" />
<property name="portletModeMap">
<entry key="view">
<ref bean="viewController" />
<entry key="edit">
<ref bean="editController" />
<entry key="help">
<ref bean="helpController" />
<entry key="config">
<ref bean="configController" />

<bean id="viewResolver"
<property name="viewClass">
<property name="prefix">
<property name="suffix">

So i had to map the config mode to configModeController bean in the portletModeMap.


srjwebsolutions said...

We are leading responsive website designing and development company in Noida.
We are offering mobile friendly responsive website designing, website development, e-commerce website, seo service and sem services in Noida.

Responsive Website Designing Company in Noida
Website Designing Company in Noida
SEO Services in Noida
SMO Services in Noida

Vikas Chaudhary said...

Battery Mantra is Authorized exide car battery dealer in Noida and Greater Noida. We are providing our service in Indirapuram, Delhi, Ashok Nagar.

Exide Battery Dealer in Noida
Battery Dealer in Noida
Authorized Battery Dealer in Noida
Car Battery Dealer in Noida
Car Battery Dealer
Exide Battery Dealer

EG MEDI said... is online medical store pharmacy in laxmi nagar Delhi. You can Order prescription/OTC medicines online.
Cash on Delivery available. Free Home Delivery

Online Pharmacy in Delhi
Buy Online medicine in Delhi
Online Pharmacy in laxmi nagar
Buy Online medicine in laxmi nagar
Onine Medical Store in Delhi
Online Medical store in laxmi nagar
Online medicine store in delhi
online medicine store in laxmi nagar
Purchase Medicine Online
Online Pharmacy India
Online Medical Store