HP Integrity NonStop H-Series User Manual
Page 119

1.
Create a c
om.hp.empinfo.service
package and an
EmployeeDao
class under the
com.hp.empinfo.service
package, as described in the
section. This will contain the logic for handling Employee Database Transactions.
2.
Modify the
EmployeeDao.java
class file to add the function for inserting employee details.
After modification, the
EmployeeDao.java
file must appear as:
package com.hp.empinfo.service;
import java.sql.SQLException;
import org.springframework.jdbc.core.support.JdbcDaoSupport;
public class EmployeeDao extends JdbcDaoSupport{
public void insertDetail(int empid, String firstname,
String lastname, int age, String email)
throws SQLException
{
getJdbcTemplate().update("insert into employee values(?,?,?,?,?)",
new Object[] { empid,firstname,lastname,age,email});
}
}
Creating and Modifying Supporting Views to Display Business Data
To create and modify supporting views to display business data, create the JSP files to create the
view by completing the following steps:
1.
Create the
insertresult.jsp
file in the
Empinfo/WebContent/Web-INF/jsp
directory
as described in the
section.
2.
Modify the
insertresult.jsp
file to provide a link to the
insert.jsp
page.
After modification, the
insertresult.jsp
file must appear as:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
"http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="/WEB-INF/jsp/include.jsp"%>
Insert Operation Successfully Executed
${model.add}
>Insert Employee
3.
Modify the
insert.jsp
file in the
EmpInfo/WebContent/Web-INF/jsp/insert.jsp
directory to receive all the input data required to add a new employee record to the database,
by completing the following steps:
1.
Delete the following
tag from the
tag.
2.
Add the following lines of code in the body tag to receive all the inputs required to add
a new employee record.
Overview of EmpInfo
119