<div dir="ltr" style="text-align: left;">
<div dir="ltr" style="text-align: left;">
<div dir="ltr" style="text-align: left;">The <i><b>getProperty tag </b></i>action is used to retrieve the value of a given property and converts it to a string, and finally inserts it into the output.The <i><b>getProperty tag </b></i>action has only two attributes, both of which are required ans simple syntax is as follows:</p>
<pre class="highlight"><;jsp:useBean id="myName" ... />; 
... 
<;jsp:getProperty name="myName" > 
<b>Explanation: </b>As shown above, getProperty tag in JSP has two attributes "name" and "property". Please note that<i><b> jsp:getProperty</b></i> tag must be used with<b><i> jsp:useBean</i></b> tag. 
<ul style="text-align: left;"> 
 	<li><b>name Attribute:</b> name attribute in JSP getProperty tag must match with useBean Tag. If JSP has multiple useBean tag, id of the useBean tag is used to identify the bean. While getting property of that bean, id in useBean tag must match with name attribute in <i><b>getProperty </b></i>Tag.</li> 
 	<li><b>property Attribute:</b> property attribute in JSP <b><i>getProperty </i></b>Tag idnetifies the property whose value is being requested by this tag.</li> 
</ul> 
<b>Example-</b> 
<i><b>Employee.java</b></i> 
 
</div> 
<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 myapp folder on webapp directory of tomcat at<br />
<b><i>C:Program Files (x86)Apache Software FoundationTomcat 7.0webapps</i></b></p>
<p>and restart server and hit the following URL<br />
<b><i>http://localhost:8080/myapp/index.jsp</i></b></p>
<div class="separator" style="clear: both; text-align: center;"><img src="https://dineshonjava.com/wp-content/uploads/2013/09/1111-2.png" border="0" /></div>
</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>
<p> ;</p>
<div style="background-color: pink; border-width: thin; text-align: center;"><b><;<;<a href="https://dineshonjava.com/setproperty-tag-in-jsp/">Previous</a> <;<; || <a href="https://dineshonjava.com/jsp-tutorial-baby-step-to-server-pages/">Index </a>|| >;>;<a href="https://dineshonjava.com/jsp-implicit-objects/">Next</a> >;>;</b></div>
</div>
<div class="wp-post-navigation"> 
									 <div class="wp-post-navigation-pre"> 
									 <a href="https://dineshonjava.com/setproperty-tag-in-jsp/">Previous</a> 
									 </div> 
									 <div class="wp-post-navigation-next"> 
									 <a href="https://dineshonjava.com/jsp-implicit-objects/">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: '336'});
});
</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…