Modifying the index.jsp file, Modifying the insert.jsp file, Modifying the – HP Integrity NonStop H-Series User Manual

Page 112: Index.jsp, File

Advertising
background image

2.

Add the tag extensions (taglibs) to include the

.jsp

file so that your

include.jsp

file

appears as:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page session="false"%>

<%@ taglib prefix="c"
uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt"
uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="form"
uri="http://www.springframework.org/tags/form" %>

NOTE:

The created header file must be included in every JSP page. This ensures that the

same definitions are included in all JSPs. You must add all the JSPs in a subdirectory named

jsp

in the

WEB-INF

directory. This allows views to be accessible via the controller because

these pages cannot be accessed via a URL.

Modifying the

index.jsp

File

To modify the

index.jsp

file, complete the following steps:

1.

Include the

include.jsp

file:

<%@ include file="/WEB-INF/jsp/include.jsp" %>

2.

Provide a link to the

insert.jsp

page as follows:

<h4><a href=<c:url value="insert.htm"/>>Insert Employee</a></h4>

3.

Delete the following line from the

<body>

tag.

<p>This is EmpInfo Test Page.</p>

After modification, the

index.jsp

file appears as:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="/WEB-INF/jsp/include.jsp" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Spring Getting Started - EmpInfo Application</title>
</head>
<body>
<h2 align="center"> Welcome to the EmpInfo Application </h2>
<br>
<h4><a href=<c:url value="insert.htm"/>>Insert Employee</a></h4>
<br>
</body>
</html>

Modifying the insert.jsp File

To modify the

insert.jsp

file, complete the following steps:

1.

Move the

insert.jsp

file to the

EmpInfo/WebContent/WEB-INF/jsp

directory by

dragging and dropping the file on your Eclipse window.

2.

Include the

include.jsp

file in

insert.jsp

:

<%@ include file="/WEB-INF/jsp/include.jsp" %>

112

Getting Started with Spring

Advertising
This manual is related to the following products: