WTL Assignment No.5
WTL Assignment No.5
WTL Assignment No.5
Assignment No: 5
Title: Design and develop suitable web application using Servlet and MySQL.
Objective:
Problem Statement
Implement the sample program demonstrating the use of Servlet.
e.g., Create a database table ebookshop (book_id, book_title, book_author, book_price, quantity)
using database like Oracle/MySQL etc. and display (use SQL select query) the table content
using servlet.
Outcomes
Theory
Servlet:
A Servlet is a server-side program written in Java. Servlet is a web component that is
deployed on the server for creating dynamic web pages. A Java servlet is a Java program
that extends the capabilities of a server. Although servlets can respond to any types of
requests, they most commonly execute applications hosted on Web servers.
Java Servlets are Java classes run by a web server that has an interpreter that supports the
Java Servlet specification.
• javax.servlet
• javax.servlet.http
Servlet Life Cycle:
Methods
o doGet-
A GET request results from a normal request for a URL or from an HTML form that has no
METHOD specified and it should be handled by the doGet() method.
o doPost-
A POST request results from an HTML form that specifically lists POST as the METHOD and it
should be handled by doPost() method.
• getParameter () − You call the request.getParameter() method to get the value of a form
parameter.
• getParameterValues () − Call this method if the parameter appears more than once and
returns multiple values, for example checkbox.
• getParameterNames () − Call this method if you want a complete list of all parameters in
the current request.
Design and Execution Steps
Following steps are used to Create and Execute web applications,
1. Design html and servlet files with an extension of.html and .java.
2. Start the Tomcat Server with port number
Test Cases
All records from the MySQL database should be displayed on the browser using JSP and
HTML.
Conclusion
Hence, we have performed the dynamic web application using Servlet and MySQL.