Actions provide an abstraction that can be used to easily encapsulate common tasks. They are specific tags that affect the runtime of the JSP and the response sent back to the client. They normally create or act on objects. The standard action types are
<jsp:param>
<jsp:include>
<jsp:forward>
<jsp:plugin>
<jsp:useBean>
<jsp:setProperty>
<jsp:getProperty>
now we discuss these one by one
JSP param
<jsp:param>
This action is used to provide other tags additional information in the form of the values. It is used in jsp:include, jsp:forward and jsp:plugin action elements. In doing so the included or forwarded page will see the request object, with original parameters augmented with the new values that take precedence over existing values. The <jsp:param> clause allows you to pass one or more name/values pairs as parameters to an included file. It syntax is
<jsp:param name=”name” values=”value />
JSP include
This action allows a static or dynamic resource to be included in the JSP at request time. An included page has access only to the jspWriter object; it cannot set headers or cookies. Its syntax is
<jsp:include page=”{relative URL|<%= expression %>}” flush=”true” />
Now let us try the example of <jsp:param> and <jsp:include>
The <jsp:forward> elements forwards the request object containing the client request information form one JSP file to another file. The target file can be an HTML file, another JSP file, or a servlet, as long as it is in the same application context as the forwarding JSP file.
the <jsp:plugin> elements plays or displays an object(an applet or Bean) in the client web browser, using Java plug-in that is built into the browser or downloaded form a specified URL. When JSP file is translated and compiled and java back an HTML response to the client, the element is replaced by either an
<jsp:setProperty>
This action is used in conjunction with used Bean to set the value of attribute of the bean. These properties can be set at earlier.
Request time form parameters in the request object
Request time form an evaluated expression
Form a specified string (hard coding)
It syntax is
< jsp:setProperty name=”beanname” propertyDetails />
<jsp:getProperty>
This a ction is complimentry to the setProperty action. It is also used in conjection with usebean to retrive the value of attributes of the bean. These values are converted to a string and printed to the output stream,
its syntax is <jsp:setProperty name=”beanname” property=”propertyname” />