MyHelloWorldPortlet
4. Specify porlet deployment descriptor details 1.
5. Specify porlet deployment descriptor details 2.
6. Specify modifiers, interfaces, and method stubs to generate Portlet class.
file: MyHelloWorld.Portlet.java
public void processAction(
ActionRequest actionRequest, ActionResponse actionResponse)
throws IOException, PortletException {
String name = actionRequest.getParameter("name");
PortletPreferences prefs = actionRequest.getPreferences();
prefs.setValue("NAME", name);
prefs.store();
actionResponse.setPortletMode(PortletMode.VIEW);
/**super.processAction(actionRequest, actionResponse); */
}
<!-- This is the <b>MyHelloWorldPortlet</b> portlet in Edit mode. -->
<form action="<portlet:actionURL/>" method="post" name="<portlet:namespace />fm">
<label for="name">Name :</label>
<input name="<portlet:namespace />name" type="text" />
<br /><br />
<input type="submit" />
</form>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<portlet:defineObjects />
<!-- This is the <b>MyHelloWorldPortlet</b> portlet in View mode. -->
<% String name = (String)request.getAttribute("ATTRIBUTE_NAME");
%>
<p>This is the Hello World Portlet</p>
<p>Hello <%= name %>! </p>