Jsp Actions

Jsp Actions: Jsp action controls the behaviour of servlet engine. There are many Jsp action tags. Jsp action tags are as follows:

jsp:include- It includes a file at the time the page is requested.

e.g:

  <jsp:include page="abc.jsp"/>

we can pass parameter to included page and get the dynamic response at run time.

  <jsp:include page="abc.jsp">
  <jsp:param name="abc" value="abc"/>
  </jsp:include>

jsp:forward- It forwards the request to another specified page.

e.g:

 
  <jsp:forward page="abc.jsp">
  <jsp:param name="abc" value="abc"/>
  </jsp:forward>

jsp:useBean- It represent the instance of a bean. If finds if bean already instanciated or not and then do the instanciation.

e.g:

  <jsp:useBean id="obj" class="abc.class" 
       scope="request|session|application|page">

id: Specify the object name.

class: Specify the bean class.

scope: Specify that bean object will be available in request|session|application|page scope.

jsp:setProperty- It is to set a value to a bean property.

e.g:

  <jsp:setProperty name="beanobj" property="name" value="">

name: Specify the bean object.

property: Specify the name of property.

value: Specify the value which we set to a property.

jsp:getProperty- It is to get the property of JavaBean and insert into output.

e.g

  <jsp:getProperty name="beanobj" property="name" />  

name: Specify the bean object.

property: Specify the name of property.

jsp:plugin- It enables the author to generate output that contains appropriate client browser dependent constructs.

  <jsp:plugin type=applet code="abc.class" codebase="/html">
  <jsp:param name="abc" value="abc"/>
  <jsp:fallback>
    Plugin not Available
  </jsp:fallback>
  </jsp:plugin>

type: It specify the type of object the plugin will execute.

class: name of the class that plugin will execute.

codeBase: Specify the directory path which contains the applet code file.

jsp:fallback- It specify the text message in case plugin not started.