Action Tags (3) .
Action Tags (3) .
ENTERPRISE PROGRAMMING
21CI2107
Topic:
Action tag
Session - 1
INSTRUCTIONAL OBJECTIVES
LEARNING OUTCOMES
Action tag
• The JSP specification provides a standard tag called Action tag used
within JSP code.
Action tag
• The action tag is also implemented to streamline flow between pages
and to employ a Java Bean.
• As it coincides with the XML standard, the syntax for the action
element is:
Syntax:
• <jsp:action_name attribute = "attribute_value" />
Action tag
1.jsp:forward: 7. jsp:element:
2.jsp:include: 8. jsp:plugin:
3.jsp:body: 9. jsp:param:
4.jsp:useBean: 10.jsp:text:
5.jsp:setProperty: 11.jsp:fallback:
6.jsp:getProperty: 12.jsp:attribute:
CREATED BY K. VICTOR BABU
SESSION DESCRIPTION (Cont..)
Two basic attributes are commonly used for all action tags. These are:
1. id: The id attribute defines unique action elements and allows actions to be
referenced within the JSP page. When the action creates an object's instance, the id
attribute is used to refer to it.
2. Scope: The scope attribute is used for identifying an action's life cycle. It correlates
with the id attribute because the scope attribute is used to establish that particular
object's lifespan associated with the ID.
Example
jsp:include Action
Syntax: <jsp:include page = "Page URL" flush = "Boolean Value" />
Example:
<!DOCTYPE html>
<html>
<head>
<title>JSP include Action</title>
</head>
<body>
<h2>JSP page: with include</h2>
<jsp:include page="header.jsp" flush="false" />
</body>
</html>
CREATED BY K. VICTOR BABU
SESSION DESCRIPTION (Cont..)
Example
jsp:forward Action
Syntax: <jsp:forward page = "URL of another static, JSP, OR Servlet page" />
Example: <!DOCTYPE html>
<html>
<head>
<title>Example for Forward Action</title>
</head>
<body>
<h2>JSP page: Demo forward</h2>
1. Which tag should be used to pass information from JSP to included JSP?
1. Describe
2. List out
3. Analyze
4. Summarize
Reference Books:
1. JSP and Java servlet programming
2. The complete Reference JSP, Phil Hanna.
3. JSP And Servlets: A Comprehensive Study, Mahesh P. Matha