Creating the rowmapper class – HP Integrity NonStop H-Series User Manual

Page 133

Advertising
background image

</tr>
<tr>
<td align="left" width="20%">
Employee Email Id :</td><td> <c:out value="${model.empemail}"/> </td>
</tr>
</table>

<a href="<c:url value="retrieveordelete.htm"/>">Back</a>
</body>
</html>

5.

Create the

deleteresult.jsp

file in the

EmpInfo/WebContent/WEB-INF/jsp

directory,

as described in the

Creating the

index.jsp

File

section.

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 - 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 the

Creating the Controller for EmpInfo

section.

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));

Overview of EmpInfo

133

Advertising
This manual is related to the following products: