jsp:getProperty Tag

The getProperty tag is used to retrieve a property from a JavaBeans instance. The syntax of the getProperty tag is as follows:

<jsp:getProperty name="beanName" property="propertyName" />

The name attribute represents the name of the JavaBean instance. The property attribute represents the property of the JavaBean whose value we want to get.

getProperty Tag

Example of getProperty with Java Bean

Following is our Java class.


import java.io.Serializable;

public class PersonBean implements Serializable
 private String name;
  public PersonBean()
   public void setName(String name)
    this.name = name;
   public String getName()
    return name;


        <title>Welcome Page</title>
    <jsp:useBean id="person" class="PersonBean" scope="request" />
        Name of Person is : <jsp:getProperty name="person" property="name" />

This will print the value of the property. What if you need to change the value of the property. Let's learn how to set value of the property in our next lesson.