Sample: Localized Display Portlet (Welcome Portlet)
Step 4: Create the Action ClassThe Welcome portlet has its own action class, The source code for
/** Copyright (c) 2003 by SAS Institute Inc., Cary, NC 27513.
* All Rights Reserved.
*/
package com.sas.portal.portlets.welcome;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.sas.portal.portlet.HTMLPortletAction;
import com.sas.portal.portlet.NavigationUtil;
import com.sas.portal.portlet.PortletContext;
/**Action for the Welcome Portlet. This prepares the localized resource
* bundles for use by the JSTL tags within the portlet's JSP.
* @version 1
*/
public final class WelcomeAction extends HTMLPortletAction {
/**
* Configure the JSTL localization context for use in the Welcome
* portlet. Returns the value of "display-page" from the portlet's
* XML descriptor.
*
* @param request The HttpServletRequest associated with the
* method invocation
* @param response HttpServletResponse associated with the
* method invocation
* @param context PortletContext mapped to the request path
*
* @return
super.service(request, response, context); NavigationUtil.prepareLocalizedResources( "com.sas.portal.portlets.welcome.res.Resources", request, context); //This comes from the portlet.xml. String url = (String) context.getAttribute("display-page"); return url; } } |