Actions are executed when the JSP page is requested by a client. They are inserted in a page using XML element syntax, and encapsulate functionality such as input validation using beans, database access, or passing control to another page. The JSP specification defines a few standard action elements, described in this section, and also includes a framework for developing custom action elements.
An action element consists of a start tag (optionally with attributes), a body, and an end tag. Other elements can be nested in the body. Here’s an example:
<jsp:forward page="nextPage.jsp"> <jsp:param name="aParam" value="aValue" /> </jsp:forward>
If the action element doesn’t have a body, a shorthand notation
can be used in which the start tag ends with
>, as shown by the
<jsp:param> action in this example. The
action element name and attribute names are case-sensitive.
Some action attributes accept a request-time attribute value, using the JSP expression syntax:
<% String headerPage = currentTemplateDir + "/header.jsp"; %> <jsp:include page="<%= headerPage %>" />
The attribute descriptions for each action in this section define whether a request-time attribute value is accepted or not.
action can only be
used in the body of a
Its body is used to specify the template text to use for browsers
that do not support the HTML
<object> elements. This action supports no
<jsp:plugin type="applet" ...