<div dir="ltr" style="text-align: left;">
<div dir="ltr" style="text-align: left;">In this Tutorial we want to describe you a code that help in describing an example from JSP bean set property.<i><b>SetProperty </b></i>tag in JSP is used to set properties of the JAVA bean.</p>
<p>General syntex of JSP <b><i>setProperty </i></b>Tag look like this:<br />
<b>Syntax:</b></p>
<pre class="highlight"><;jsp:setProperty name="xyz" > 
The code include a package bean , we have a class Employees. The employee class include a string variable first name, last name and address. Inside the class we have a setter and getter method. 
1. set XXX ( ): This method hold the value of the parameter by the implementor of interface. 
2. get XXX( ): This method retrieve the value of the parameter set in the setXXX () method. 
The JSP page uses this getter and setter method. 
 
<b><;jsp:useBean>; - </b> 
1. The <b><; jsp:use Bean>;</b> instantiate a bean class and locate a bean class with specific scope and name. 
<ul style="text-align: left;"> 
 	<li><b>id </b>- A id variable is used to identify the bean in the scope .</li> 
 	<li><b>class </b>-The class is represented as Package. class and instantiate a bean from class. The class should be public</li> 
 	<li><b>scope </b>-This describe you the scope of the bean in which it exists.</li> 
</ul> 
2.<b> <;jsp:set Property>;</b> This is used to set the value of one or more properties of bean using setter method. The value of the name must match with the Id. 
3. <b><;jsp:get Property>;</b> This is used to return the bean property value using property getter method in bean package. 
 
<b>Example-</b> 
<i><b>Employee.java</b></i> 
<pre class="highlight">package com.dineshonjava.bean; 
 
/** 
 * @author Dinesh Rajput 
 * 
 */ 
public class Employee { 
 private String firstName; 
 private String lastName; 
 private String address; 
 
 public String getFirstName() { 
 return firstName; 
 } 
 public void setFirstName(String firstName) { 
 this.firstName = firstName; 
 } 
 public String getLastName() { 
 return lastName; 
 } 
 public void setLastName(String lastName) { 
 this.lastName = lastName; 
 } 
 public String getAddress() { 
 return address; 
 } 
 public void setAddress(String address) { 
 this.address = address; 
 } 
 
} 
</pre>
<p><i><b>index.jsp</b></i></p>
<pre class="highlight"><;%@page contentType="text/html"%>;<br />
<;%@page pageEncoding="UTF-8"%>;<br />
<;html>;<br />
 <;body>;<br />
 <;h1>;Employee Form Bean Value<;/h1>;<br />
 <;jsp:useBean id="emp" class="com.dineshonjava.bean.Employee" scope="page" />;</p>
<p> <;jsp:setProperty name="emp" ><br />
Copy <b>myapp </b>folder on <b>webapp </b>directory of tomcat at<br />
<i><b>C:Program Files (x86)Apache Software FoundationTomcat 7.0webapps</b></i></p>
<p>and restart server and hit the following URL<br />
<i><b>http://localhost:8080/myapp/index.jsp</b></i></p>
<div class="separator" style="clear: both; text-align: center;"><img src="https://dineshonjava.com/wp-content/uploads/2013/09/1111-3.png" border="0" /></div>
<p><b><a href="https://sites.google.com/a/dineshonjava.com/dineshonjava/dineshonjava/myapp.zip?attredirects=0&;d=1" target="_blank" rel="noopener">Download Example</a></b></p>
</div>
<p> ;</p>
<div style="background-color: pink; border-width: thin; text-align: center;"><b><;<;<a href="https://dineshonjava.com/jsp-usebean-tag/">Previous</a> <;<; || <a href="https://dineshonjava.com/jsp-tutorial-baby-step-to-server-pages/">Index </a>|| >;>;<a href="https://dineshonjava.com/getproperty-tag-in-jsp/">Next</a> >;>;</b></div>
</div>
<div class="wp-post-navigation"> 
									 <div class="wp-post-navigation-pre"> 
									 <a href="https://dineshonjava.com/jsp-usebean-tag/">Previous</a> 
									 </div> 
									 <div class="wp-post-navigation-next"> 
									 <a href="https://dineshonjava.com/getproperty-tag-in-jsp/">Next</a> 
									 </div> 
									</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
 $.post('https://dineshonjava.com/wp-admin/admin-ajax.php', {action: 'mts_view_count', id: '337'});
});
</script>
Strategy Design Patterns We can easily create a strategy design pattern using lambda. To implement…
Decorator Pattern A decorator pattern allows a user to add new functionality to an existing…
Delegating pattern In software engineering, the delegation pattern is an object-oriented design pattern that allows…
Technology has emerged a lot in the last decade, and now we have artificial intelligence;…
Managing a database is becoming increasingly complex now due to the vast amount of data…
Overview In this article, we will explore Spring Scheduler how we could use it by…