JSP actions

Actions are standard tags that perform common actions. All JSP standard actions use the prefix jsp.

You can insert any of the following actions:

<jsp:useBean>

The useBean, getProperty, and setProperty actions are all used with JavaBeans components. The useBean id attribute is the name of the bean and corresponds to the name attribute for getProperty and setProperty. The useBean action locates or instantiates a JavaBeans component:

<jsp:useBean id="labelLink" scope="session" class="LinkBean.labelLink" />

The bean class and classes required by the bean class must be deployed under a JavaCode base that is available to the Web Application where the JSP is installed.

<jsp:getProperty>

The getProperty action gets the value of a JavaBeans component property so that you can display it in a result page:

<jsp:getProperty name="labelLink" property="url" />

<jsp:setProperty>

The setProperty action sets a property value or values in a JavaBeans component:

<jsp:setProperty name="labelLink" property="url" value="<%= labelLink.getURL() %>"/>

<jsp:include>

The include action includes a static file or sends a request to a dynamic file:

<jsp:include page="cart.html" flush="true" />

<jsp:forward>

The forward action forwards a client request to an HTML file, JSP file, or servlet for processing:

<jsp:forward page="/jsp/datafiles/ListSort.jsp" />

<jsp:param>

The param action specifies request parameters in the body of an include or forward action. It can also be used in the body of a params action.

<jsp:forward page="/jsp/datafiles/ListSort.jsp" />
   <jsp:param name="bgColor" value="blue" />
</jsp:forward>

<jsp:params>

The params action can be used only in the body of a plugin action to enclose the applet parameters specified by param actions.

<jsp:plugin>

The plugin action downloads plug-in software to the Web browser to execute an applet or JavaBeans component. It generates HTML <embed> or <object> elements in the page. You can use the params and param actions to specify parameters required by the plug-in, and the fallback action to specify the text that displays if the browser does not support <embed> or <object> elements:

<jsp:plugin type=applet code=”Calc.class” codebase=”/mathutils” >
   <jsp:params>
      <jsp:param name=”multiplier”          value=”multipliers/tax.val”/>
   </jsp:params>
   <jsp:fallback>
      <p> unable to start plugin </p>
   </jsp:fallback>
</jsp:plugin>

<jsp:fallback>

The fallback action can be used only in the body of a plugin action to specify the text that displays if the browser does not support <embed> or <object> elements.