Sample Application: DatabaseAccess
We'll start with index.jsp, the entry point of our application. This is the file directly accessed by the web browser.
http://yourdomain.com/DBO/index.jsp
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%--
// Executes any query entered by user.
// Select query will display the result as a list.
// Update and delete queries will be performed and give the success of failure
// message.
// This is the index page which is provided with a text area to enter the query
// to be executed.
// The program is implemented using usebean with database connections and query
// execution are performed in jsp beans.
--%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Enter your query Here</title>
</head>
<body bgcolor="#ABBCD1">
<table bgcolor="#CFD9E9">
<form action="dpoperation.jsp" method="post">
<tr><td align="center">Enter your query Here :</td></tr>
<tr><td align="center"><textarea name="query" rows="4" cols="20"></textarea></td></tr>
<tr><td><input type="submit" value="Submit"></td></tr>
</form>
</table>
</body>
</html>
index.jsp will pass the query entered by the user to servlet to execute it in the servlet.