SAS 9.1.3 Integration Technologies » SAS Web Infrastructure Kit: Developer's Guide


Developing Custom Portlets
Development Steps
Creating a Deployment Descriptor
Creating Display Resources Files
Developing the Presentation JSP Page
Creating Action Classes
Implementing Portlet Help
Creating a PAR File
Use Cases
Simple Display Portlet
Localized Portlet
Portlet Template (Editable Portlet)
Remote Portlet
Tips and Best Practices
Using the Portlet API
Sample Portlets
Localized Display Portlet (Welcome)
Interactive Form Portlet (FormExample)
Portlet Template, or Editable Portlet (DisplayURL)
Web Application (HelloUserWikExample)
Remote Portlet (HelloUserRemote
Portlet
Sample: Portlet Template, or Editable Portlet (DisplayURL)

Display Action

The DisplayAction class is the default action class for the DisplayURL portlet. This means that the class is to be invoked before the portlet's JSP page renders. The source code follows.


/**Copyright (c) 2003 by SAS Institute Inc., Cary, NC 27513.
 * All Rights Reserved.
 */
package com.sas.portal.portlets.displayurl;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
//import com.sas.portal.Logger;
import com.sas.portal.portlet.PortletContext;


/**
 * Action class that presents the display page. It sets up the display
 * model then instructs the portlet container to present the display
 * page.
 */
public final class  DisplayAction extends BaseAction
{
//    private final String _loggingContext = this.getClass().getName();

    /**
     * Service the portlet request.
     *
     * @param request the HttpServletRequest
     * @param response the HttpServeltResponse
     * @param context the PortletContext
     * @return the URL to call
     */
    public String service(HttpServletRequest request,
                          HttpServletResponse response,
                          PortletContext context) throws Exception
    {
       super.service(request, response, context);

       // see if there is an initialization error
       errorCheck(context);
       return (String)context.getAttribute("display-page");
    }
}