User Manual

</body>
</html>
5. Create the deleteresult.jsp file in the EmpInfo/WebContent/WEB-INF/jsp directory,
as described in “Creating the index.jsp File” (page 80).
6. Modify the deleteresult.jsp file to remove the details of an employee record from the
JSP page.
After modification, the deleteresult.jsp file appears as:
<%@ include file="/WEB-INF/jsp/include.jsp"%>
<%@ taglib prefix="form"
uri="http://www.springframework.org/tags/form"%>
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-1">
<title> Spring Getting Started with EmpInfo Application </title>
</head>
<body text="#00008B" >
<h2>Employee Deleted</h2>
<br>
${model.del}
<br>
<a href=<c:url value="retrieveordelete.htm"/>>Back </a>
</body>
</html>
Creating the RowMapper Class
The RowMapper class is used to map the retrieved ResultSet to the POJO class.
To create the RowMapper class, complete the following steps:
1. Create a class EmployeeRowMapper in the com.hp.empinfo.domain package, as
described in “Creating the Controller for EmpInfo” (page 91).
2. Modify the EmployeeRowMapper.java file to map ResultSet to the Employee.java
class.
After modification, the EmployeeRowMapper.java file appears as:
package com.hp.empinfo.domain;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.jdbc.core.RowMapper;
public class EmployeeRowMapper implements RowMapper {
public Object mapRow(ResultSet rs, int rowcount) throws SQLException {
Employee employee=new Employee();
employee.setEmpid(rs.getInt(1));
employee.setFirstname(rs.getString(2));
employee.setLastname(rs.getString(3));
employee.setAge(rs.getInt(4));
employee.setEmail(rs.getString(5));
return employee;
}
}
118 Getting Started with Spring