|
Development Steps
Implementing Portlet Help
You can easily implement help for a custom portlet. If you implement help for a portlet, then a help icon appears in the portlet's title bar. When a user clicks the icon, the portlet help appears in a resizable, scrollable window that is by default 400 pixels wide and 200 pixels high, as shown in this example:
To implement portlet help, use these steps:
-
Create an action class to display the JSP page for the help (or, if you want, you can use an instance of com.sas.portal.portlet.JspPortlet ). Here is an example of a custom action class to display portlet help:
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.PortletContext;
public class HelpAction extends HTMLPortletAction {
public String service(HttpServletRequest request,
HttpServletResponse response, PortletContext context)
throws Exception {
return "help.jsp";
}
}
-
Create a JSP page that contains the help text. The JSP page must have the following characteristics:
-
The JSP page must be an HTML fragment; that is, it must not contain starting and ending <HTML> , <HEAD> , or <BODY> tags.
-
The JSP page must have the file name help.jsp .
The example JSP page for the help window that was shown previously consists of just one line:
<em>This</em> is an example of <b>Portlet provided</b> help.
-
In the portlet's deployment descriptor (XML) file, add a <portlet-action> element for the action class. Set the element's help attribute to "true,".
Here is an example of the <portlet-action> element for a portlet that uses a custom action to display its help:
<portlet-action name="help" help="true">
<type>com.sas.portal.portlets.welcome.HelpAction</type> </portlet-action>
Here is an example of a <portlet-action> element for a portlet that uses an instance of com.sas.portal.portlet.JspPortlet to display its help:
<portlet-action name="help" help="true">
<type>com.sas.portal.portlet.JspPortlet</type>
</portlet-action>
|