<jsp:useBean id="myName" ... /> ... <jsp:getProperty name="myName" > Explanation: As shown above, getProperty tag in JSP has two attributes "name" and "property". Please note that jsp:getProperty tag must be used with jsp:useBean tag.
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;
}
}
index.jsp
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<html>
<body>
<h1>Employee Form Bean Value</h1>
<jsp:useBean id="emp" class="com.dineshonjava.bean.Employee" scope="page" /><jsp:setProperty name="emp" >
Copy myapp folder on webapp directory of tomcat at
C:Program Files (x86)Apache Software FoundationTomcat 7.0webappsand restart server and hit the following URL
http://localhost:8080/myapp/index.jsp
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…