Pr.Pg Next Pg

JSP Actions tutorials

  • The JSP standard actions provide an abstraction that can be used to easily encapsulate common actions.

  • Servlet container provides many built in functionality to ease the development of the applications. Programmers can use these functions in JSP applications. The JSP Actions tags enables the programmer to use these functions.

  • The JSP Actions are XML tags that can be used in the JSP page.

  • JSP Action tag look’s below:

< jsp:action_name attribute = ”value” />

  • Below chart shows the JSP Actions tags:




Includes a file at the time the page is requested


Use to provide tag/value pair of information.


Finds or instantiates a JavaBean


Sets the property of a JavaBean


Inserts the property of a JavaBean into the output


Forwards the requester to a new page


Generates browser-specific code that makes an OBJECT or EMBED tag for the Java plugin


Defines XML elements dynamically.


Defines dynamically defined XML element's attribute.


Defines dynamically defined XML element's body.


Use to write template text in JSP pages and documents.



  • The <jsp:include> provide the mechanism for including additional static and dynamic resources in the current JSP pages.

  • The syntax for this action is given below:

<jsp:include page = “url” flush = “true” />

  • Below table shows the attributes of <jsp:include>





This attribute represents the relative URL of the resources to included.


This attribute represents a mandatory Boolean value stating whether or not the buffer should be flushed. Currently true is the only valid value for this attribute.



  • The <jsp:param> action is used to provide tag/value pair of information, by including them as sub attributes of the <jsp:include>, <jsp:forward> and the <jsp:plugin> action.

  • Syntax of <jsp:param> is given below:

<jsp:param name = ”paramname” value = “paramvalue”>

  • Below table shows the attributes of <jsp:param>





This attribute represents the name of the parameter being referenced.


This attribute represents the value of the named parameter.



  • Beans are also called mutators. They are the reusable component which mostly contains the setter and getter values

  • The <jsp:useBean> is a standard action element that is use for locate or instantiates a JavaBeans component.

  • The Syntax for the useBean is given below:

<jsp:useBean id = “name” class=”class name” />

  • Firstly <jsp: useBean> tries to locate an instance of the Bean class if found its fine, if not then it will instantiates it from a class.

  • The name of the bean is same as we have given in id attribute of <jsp:useBean>.

  • If the object reference doesn't exist with the name we have specify  then it will create a instance and find the scope of the variable, class attributes defines the bean class and type attribute defines the parent class or interface of the Bean class.

  • Below table shows the attribute of <jsp:useBean>





Gives the name of the bean as specified by the instantiate () method of the

java.beans.Beans class.


Specifies the type of the variable that will refer to the object.


Designates the full package name of the bean.



  • The setProperty action sets the value of a bean’s property.  This tag can't be used without <jsp:useBean> tag so, it is necessary to use the “useBean” tag to declare the Bean.

  • You would have to careful while assigning the value of name attribute of <jsp:setProperty> tag, value of name must be the same as the value of id attribute of <jsp:useBean> tag.

  • Syntax of <jsp:setProperty>

<jsp:setProperty name = “beanName” property = “propName” value = “string value”/>

  • Below table shows the attributes of <jsp:setProperty>





Indicates the property you want to set. A value of "*" means that all request parameters whose names match bean property names will be passed to the appropriate setter methods.


Designates the bean whose property will be set. The Bean must have been previously defined.


The value that is to be assigned to the given property. The parameter's value is null, or the parameter does not exist, the setProperty action is ignored.


The param attribute is the name of the request parameter whose value the property is to receive. You can't use both value and param, but it is permissible to use neither.



  • This element retrieves the value of a bean property, converts it to a string, and inserts it into the output.

  • The two required attributes are name, the name of a bean previously referenced via <jsp:useBean>, and property, the property whose value should be inserted.

  • Syntax of <jsp:getProperty> is below:

<jsp:getProperty name = “beanName” property = “propName” />

  • Below is the attribute of <jsp:getProperty>





The property attribute is the name of the Bean property to be retrieved.


The name of the Bean that has a property to be retrieved. The Bean must have been previously defined.



  • The <jsp:forward/> action is used to permanently transfer processing from one JSP to another on the local server. 

  • Any content generated by the original page is discarded and the processing begins anew at the second JSP.

  • Syntax of <jsp:forward> is below:

<jsp:forward page = “URL” />

  • Below table shows the attribute of <jsp:forward>





It consists of a relative URL of another resource such as a static page, another JSP page, or a Java Servlet.



  • The <jsp:plugin> is used to display an object, especially an applet or a Bean on the client browser.

  • When the Jsp file is translated and compiled, the <jsp:plugin> is replaced by either an <object> or <embed> element, it is based on the browser version. 

  • The plugin action has several attributes that correspond to common HTML tags used to format Java components. The <param> element can also be used to send parameters to the Applet or Bean.

  • Syntax of <jsp:plugin> is below:

<jsp:plugin type = “app type” code = “app code file” width= “60” height= “80” />



  • A jsp:text element is used to enclose template data in the XML representation. A  jsp:text element has no attributes and can appear anywhere that template data can.

  • The interpretation of a jsp:text element is to pass its content through to the current value of out.

  • Syntax of <jsp:text>

<jsp:text>templet data</jsp:text>

Pr.Pg border                                              Next Pg