|
Sample: Portlet Template, or Editable Portlet (DisplayURL)
Editor ActionThe DisplayURL portlet's
/**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;
import com.sas.portal.portlet.NavigationUtil;
/**
* Action class that presents the edit page. It sets up the edit model
* then instructs the portlet container to present the edit page.
*/
public final class EditorAction 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);
//create the URLs for the OK and Cancel buttons.
String url;
url = NavigationUtil.buildBaseURL(context, request,
"ok");
context.setAttribute(Initializer.EDIT_OK_URL_KEY, url);
url = NavigationUtil.buildBaseURL(context, request,
"cancel");
context.setAttribute(Initializer.EDIT_CANCEL_URL_KEY, url);
// the following call resets the mode back to display for the
// next call
context.resetMode();
return (String) context.getAttribute("edit-page");
}
}
|