JSP Events

Action events allow you tie events that occur on the user interface, such as a form being submitted, or a button clicked, to post back to a specific event handler on a JspPortletAction class.

Although our example uses a single action event ("refresh"), it is possible to use multiple events per portlet. In short, declaring an action event involves:

  • 1. Specifying the name of your JspPortletAction as using a hidden input field called "action",
  • 2. Defining a submit button named with the following convention: "eventSubmit_{action-name}",
  • 3. Declaring an event handler in your JspPortletAction called {action-name}.

For example:


<form method="post" action="<jetspeed:dynamicUri/>">
 <input type="hidden" name="js_peid" value="<%=jspeid%>">
 <input type="hidden" name="action" value=" portlets.myJspPortletAction"/>
 <input type="submit" name="eventSubmit_doUpdate" value="Save"/>


public void doUpdate(RunData rundata, Portlet portlet) throws Exception
{
    // action logic goes here
}


You may refer to the following section in Tutorial 7 for an example of using action events.