There are numerous JSP action tags or elements. Every JSP action tag is made in use to carry out some defined tasks.
The action tags are made in use to command the flow in the middle of pages and to use Java Bean. Below some jsp action tags are given:
JSP Action Tags | Description |
jsp:forward | sends the request and reply to another resource. |
jsp:include | Comprise another resource. |
jsp:useBean | makes or locates bean objects. |
jsp:setProperty | fix the value of property in the bean object. |
jsp:getProperty | prints the value of a property of the bean. |
jsp:plugin | embeds some other element such as applet. |
jsp:param | sets the parameter value. It is made in advance and included mostly. |
jsp:fallback | can be made in use to print the message if the plugin is working. It is used in the jsp:plugin. |
The jsp:useBean, jsp:setProperty and jsp:getProperty tags are made in use for bean development. So we can view these tags in bean development.
The jsp:forward action tag is made in use to forward the request to some other resource; it may be jsp, html or any other resource.
<jsp:forward page="relativeURL ' <%= expression %>" />
<jsp:forward page="relativeURL ' <%= expression %>">
<jsp:param name="parametername" value="parametervalue ' <%=expression%>" />
</jsp:forward>
We are simply sending the request to the printdate.jsp file In this below given example.
index.jsp
<html> <body> <h2>this is index page</h2> <jsp:forward page="printdate.jsp" /> </body> </html>
printdate.jsp
<html> <body> <% out.print("Today is:"+java.util.Calendar.getInstance().getTime()); %> </body> </html>
We are sending the request to the printdate.jsp file with parameter and printdate.jsp file prints the parameter amount with date and time, in the below given example.
index.jsp
<html> <body> <h2>this is index page</h2> <jsp:forward page="printdate.jsp" > <jsp:param name="name" value="javatpoint.com" /> </jsp:forward> </body> </html>
printdate.jsp
<html> <body> <% out.print("Today is:"+java.util.Calendar.getInstance().getTime()); %> <%= request.getParameter("name") %> </body> </html>