Sample Portlets
Sample: Interactive Form Portlet (FormExample)
The sample portlet called FormExample is an interactive portlet. It accepts free-form input from the user, as shown here:
When the user clicks Submit Form, the portlet displays the entered text back to the user, as shown here:
FormExample is a local portlet that runs inside the portlet container. It was developed using a JavaBean, which places values in the PortletContext object so that the values are available to the JSP page. The HttpServletRequest or HttpSession object could be used for this purpose. However, the PortletContext object is unique to the portlet and is not shared with other processes. Therefore, using it avoids collisions that could cause attribute values to be overwritten.
The following steps were used to create the FormExample portlet. Click on each step to display details.
Create a directory structure for the portlet.
Create the portlet deployment descriptor (portlet.xml ).
Create the display page (FormExample.jsp ).
Create the action class (DisplayAction.class ).
Create the bean.
Create the PAR file, and deploy and test the portlet.
|