JSP Action Tag

Click to rate this post!
[Total: 0 Average: 0]
JSP Action Tag:

There are numerous JSP activity labels or components. Each JSP activity tag is utilized to play out some particular undertakings. The activity labels are utilized to control the stream among  pages and to utilize Java Bean.

  • jsp:forward
  • jsp:include
  • jsp:param
  • jsp:useBean
  • jsp:setProperty
  • jsp:getProperty

forward action tag:

It requests to another resource by jsp or html

 Syntax of jsp:forward action tag without parameter:

<jsp:forward page=”relativeURL | <%= expression %>” />

 Syntax of jsp:forward action tag with parameter:

<jsp:forward page=”relativeURL | <%= expression %>”>

<jsp:param name=”parametername” value=”parametervalue | <%=expression%>” />

</jsp:forward>

include action tag:

The jsp:include activity tag is utilized to incorporate the substance of another asset it might be jsp, html or servlet. The jsp incorporate activity tag incorporates the asset at ask for time so it is better for dynamic pages in light of the fact that there may be changes in future. The jsp:include tag can be utilized to incorporate static and dynamic pages.

Include action and directive

Syntax of jsp:include action tag without parameter

<jsp:include page=”relativeURL | <%= expression %>” />

Syntax of jsp:include action tag with parameter

<jsp:include page=”relativeURL | <%= expression %>”>

<jsp:param name=”parametername” value=”parametervalue | <%=expression%>” />

</jsp:include>
 Java Bean

A Java Bean is a java class

  •  no-arg constructor.
  • Serializable.
  • The methods to set and get the values of the methods, known as getter and setter methods.
Why use Java Bean?
 it is a reusable software component. A bean can be arranged in to many objects int one object, so this object from multiple places, it is easy maintenance.
Simple example of java bean class

//Employee.java

package mypack;

public class Employee implements java.io.Serializable{

private int id;

private String name;

public Employee(){}

public void setId(int id){this.id=id;}

public int getId(){return id;}

public void setName(String name){this.name=name;}

public String getName(){return name;}

}

 

Ø By using getter and setter methods to access the java bean class.

package mypack;

public class Test{

public static void main(String args[]){

Employee e=new Employee();//object is created

e.setName(“Arjun”);//setting value to the object

System.out.println(e.getName());

}}

jsp:useBean action tag:

The jsp:useBean activity tag is utilized to find or instantiate a bean class. In the event that bean protest of the Bean class is now made, it doesn’t make the bean contingent upon the extension. In any case, if protest of bean is not made, it instantiates the bean.

Syntax of jsp:useBean action tag:

<jsp:useBean id= “instanceName” scope= “page | request | session | application”

class= “packageName.className” type= “packageName.className”

beanName=”packageName.className | <%= expression >” >

</jsp:useBean>

Attributes and Usage :
Id,scope,class,type,beam name

 Set and get property:

The setProperty and getProperty activity labels are utilized for creating web application with Java Bean. In web devlopment, bean class is for the most part utilized in light of the fact that it is a reusable programming segment that speaks to information..

 Syntax :

<jsp:setProperty name=”instanceOfBean” property= “*”   |

property=”propertyName” param=”parameterName”  |

property=”propertyName” value=”{ string | <%= expression %>}”

/>

Displaying applet in JSP :

The active lag is utilized to insert applet in the jsp document and active tag downloads module at customer side to execute an applet or bean.

Syntax:

<jsp:plugin type= “applet | bean” code= “nameOfClassFile”

codebase= “directoryNameOfClassFile”

</jsp:plugin>

Subscribe
to our newsletter

Drop Us A Query

Trending Courses
  • Microsoft Azure Architect Technologies(AZ-300) | ITGuru
    Microsoft Azure Architect Technologies(AZ-300)
  • Azure is a great Microsoft Cloud Computing platform in providing various cloud services through online. ITGuru Certified Azure Architect certification course gives you the practical knowledge on Azure Cloud platform through real-world use cases from live experts

  • ServiceNow Admin Training | ITGuru
    ServiceNow Admin Training
  • Getting knowledge of cloud platforms like ServiceNow is essential in today’s world for the smooth running of projects in cloud platform. Turn your dream to the reality of becoming the Certified ServiceNow Administrator through ServiceNow Administration online certification Course with practical examples by live industry experts through online at ITGuru with real-world use cases.

  • Workday Financials Training | ITGuru
    Workday Financials Training
  • knowing the basics on any platform like Workday is not enough to sustain the IT industry. Hence it is essential to go beyond on Workday basics like Workday Financials training which lets you know the application of Financials management in real -world use cases from ITGuru Live Experts in a practical way.

  • Workday Training
  • An organization is considered as the best one when it offers the best benefits to the employee. Moreover, the greater the employee benefits, the greater the contribution to the organization. ITGuru let you know the practical workday Human Resource Management(HRM) features with live examples by experts

  • Python Online Course | ITGuru
    Python Online Course
  • Turn your dream into reality by ITGuru live experts with real-world use cases through practical knowledge on python online course and become the certified associate in python programming and become a master in python programming

  • Python Programming | ITGuru
    Python Programming
  • Python is the trending programming language in the IT industry. Mastering in python programming gives you more value among the people in the IT industry. Hence start today to learn python programming online by live experts with real-time uses cases at ITGuru


100% Secure Payments. All major credit & debit cards accepted.

Call Now Button