Example & Tutorial understanding programming in easy ways.

What is action tag in jsp? explain with example?.

JSP provides a bunch of standard action tags that we can use for specific tasks such as working with java bean objects, including other resource, forward the request to other resource etc.

The following is the list of Standard Actions in JSP.              

                      JSP Action                        Description
jsp:getProperty To get the property of a java bean, used with jsp:useBean action.
jsp:useBean To get the java bean object from given scope or to create a new object of java bean.
jsp:setProperty  To set the property of a java bean object, used with jsp:useBean action.
jsp:include To include a resource at runtime, can be HTML, JSP or any other file
  To define the dynamically generated XML element body
jsp:forward   To forward the request to another resource.
To write template text in JSP page.
jsp:element     To define the XML elements dynamically.
jsp:attribute         To define the dynamically generated XML element attributes
jsp:plugin    To generate the browser-specific code that makes an OBJECT or EMBED tag for the Java plugin.


Some important action tags with example here...

example: jsp forword action



<jsp:forward page="pass.jsp"/>



In the above exampe we use the Standard Tag "<jsp:forward page" to redirect to the "pass.jsp" page.

example: jsp include action

Like include page directive this action is also used to insert a JSP file in another file.


<jsp:include page="page URL" flush="Boolean Value" />


<html>  <head>

<title>Demo of JSP include Action Tag</title>


<h3>JSP page: Demo Include</h3>

<jsp:include page="test.jsp" flush="false" />


Read More →
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!