In this tutorial you will learn about the JSP Action Tags and its application with practical example.
JSP provides some Action Tags which we can use within JSP pages. It’s a bunch of standard action tag which are used for specific task. These all tags begin with jsp: prefix.
Syntax:
1 |
<jsp:action_tag_name attribute = "value" /> |
There are many Action Tags which are listed below and are used to perform some specific task.
1.jsp:forward: This tag is used to forward the request to new page.
Syntax:
1 |
<jsp:forward page="Relative URL" /> |
2.jsp:useBean: This tag is used to instantiates a Java Bean.
Syntax:
1 2 3 4 5 |
<jsp:useBean id= "instanceName" scope= "page | request | session | application" class= "packageName.className" type= "packageName.className" beanName="packageName.className | <%= expression >" /> |
4.jsp:setProperty: This tag is used to sets the value to the bean object.
Syntax:
1 |
<jsp:setProperty name="beanId" property="some Property" value="some value" /> |
5.jsp:getProperty: This tag is used to get the value from the bean object.
Syntax:
1 |
<jsp:setProperty name="beanId" property="some Property" .../> |
6.jsp:include: This tag is used to include some external resources at runtime response.
Syntax:
1 |
<jsp:include page="Relative URL" /> |
7.jsp:plugin: This tag is used to generates the browser specific code that makes an OBJECT or EMBED tag for the Java Plugin. In short it is used to insert Java component into JSP page.
Syntax:
1 |
<jsp:plugin type="applet|bean" code="name of class file" codebase="directory name of Class file" /> |
8.jsp:params: This tag is used to sets the parameter value to request object. Mostly it is used with include and forward tag.
Syntax:
1 |
<jsp:param name="parameter name" value="parameter value/> |
9.jsp:fallback: This tag can be used to print the message if plugin is working and also supplies alternate text if java plugin is unavailable. It is used in jsp:plugin Action Tag.
Syntax:
1 |
<jsp:fallback>Text Message For User</jsp:fallback> |
From next article we will discuss each tag briefly, It was simple overview of Action Tags.