arpita industrial trainingppt

32
Dr. M.C. Saxena College of Engineering & Technology, Lucknow An Industrial Training Presentation for the partially fulfillment of Two Months Industrial Training on “Web Development using JSP & Servlets” Completed at “ UPTEC Computer Consultancy Ltd, Lucknow” by: Arpita Srivastava University Roll No. 1316310012 ( 2017 Batch, 7 th Sem CSE) On 15 th Nov, 2016 At Department of Computer Science and Engineering

Upload: arpita-srivastava

Post on 10-Jan-2017

45 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Arpita industrial trainingppt

Dr. M.C. Saxena College of Engineering & Technology, Lucknow

An Industrial Training Presentation for the partially fulfillment of

Two Months Industrial Training on

“Web Development using JSP & Servlets”

Completed at “ UPTEC Computer Consultancy Ltd, Lucknow”

by:Arpita Srivastava

University Roll No. 1316310012 ( 2017 Batch, 7th Sem CSE)

On 15th Nov, 2016At

Department of Computer Science and Engineering

Page 2: Arpita industrial trainingppt

OUTLINES OF PRESENTATION Company Background Industrial Training Objectives What is Web Development ? Tools Used for Web Development Technologies Used for Web Development Servlets JSP JDBC Three Tier Architecture Proposed Architecture of Web Applications Project Assigned Conclusion of Training

Page 3: Arpita industrial trainingppt

COMPANY BACKGROUND

UPTEC Computer Consultancy Ltd. – a premier IT company established in 1993 as a joint venture with UP Electronics Corporation Limited, a public sector enterprise.

UPTEC’s various divisions presently encompass Professional Education, Software development, IT Product & services, Web based services and Content Design and Development.

Page 4: Arpita industrial trainingppt

INDUSTRIAL TRAINING OBJECTIVES

The Purpose of Industrial Training is to expose students to the world of work so that they can relate theoretical knowledge with application in Industry.

The Objectives of Industrial Training are:

To develop skills in the application of theory to practical work situations.

To develop skills and techniques directly applicable to their careers.

To enhance the ability to improve students creativity skills and sharing ideas.

Page 5: Arpita industrial trainingppt

WHAT IS WEB DEVELOPMENT? Web development broadly refers to the tasks

associated with developing websites for hosting via intranet or Internet.

The Web development hierarchy is as follows:

Client-side coding Server-side coding Database technology

Page 6: Arpita industrial trainingppt

TOOLS USED FOR WEB DEVELOPMENT

IDE (Integrated Development Environment): Netbeans 8.0 .2

Web Server: Apache-Tomcat-8.0.23

Database: MySQL

Page 7: Arpita industrial trainingppt

TECHNOLOGIES USED FOR WEB DEVELOPMENT

JSP (Java Server Pages): Used as a Presentation Layer.

Servlets: Used for Backend Processing.

RDBMS (Relational Database Management System): Used for storing and retrieving data.

Page 8: Arpita industrial trainingppt

SERVLETS Java Servlets are programs that run on a Web or

Application server and act as a middle layer between a request coming from a Web browser or other HTTP client and databases or applications on the HTTP server.

Page 9: Arpita industrial trainingppt

SERVLETS Creating a Servlet: By implementing Servlet interface.

By extending GenericServlet class.

By extending HttpServlet class.

Page 10: Arpita industrial trainingppt

SERVLETSLife Cycle of Servlets: A servlet life cycle can be defined as the

entire process from its creation till the destruction. The following are the paths followed by a servlet:

Page 11: Arpita industrial trainingppt

SERVLETSLife Cycle of Servlets:

The servlet is initialized by calling the init () method.

The servlet calls service() method to process a client's request.

The servlet is terminated by calling the destroy() method.

Finally, servlet is garbage collected by the garbage collector of the JVM.

Page 12: Arpita industrial trainingppt

SERVLETS Common Structure of Servlets: A Servlet extends the HttpServlet

abstract class. By doing that, the "servlet container" makes this "servlet" accessible to the web.

By "Servlet Container" are web servers

such as Tomcat that are able to understand servlets and JSP syntax.

Basically, a java servlet has the following structure:

Page 13: Arpita industrial trainingppt

SERVLETSimport java.io.*; import javax.servlet.http.*; import javax.servlet.*; public class hello extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse

response) throws IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.print("Hello World from GET method "); } public void doPost(HttpServletRequest request, HttpServletResponse

response) throws IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.print("Hello World from POST method "); } }

Page 14: Arpita industrial trainingppt

JSPA JavaServer Pages component is a type of Java servlet that is designed to fulfill the role of a user interface for a Java web application. 

Page 15: Arpita industrial trainingppt

JSP Architecture: JSPs run in two

phases Translation Phase Execution Phase

In translation phase JSP page is compiled into a servlet. called JSP Page

Implementation class In execution phase

the compliled JSP is processed

Send Response

Receive Request

Load Servlet Compile JSPServlet

Generate JSPServlet Source

Parse JSPJSP ServletCurrent?

JSP ServletLoaded?

GenerateResponse

Yes

No

NoYes

HTTP Server

JSP Container Page Compiler Servlet

JSP Page Servlet

Page 16: Arpita industrial trainingppt

JSP JSP Scripting Elements:

JSP Scriptlet Tag: <%  java source code %>

JSP Expression Tag: <%=  statement %>

JSP Declaration Tag: <%!  field or method declaration %>

Page 17: Arpita industrial trainingppt

JSP COMMON STRUCTURE OF A JSP PAGE: A JSP page define certain objects that are

accessible always, like: request, out, response and session.

For instance, to print something you can do: <html><title>TEST</title>

<body><%= "Hello World %> </body> </html>

Then save this in a file with JSP extension.

Page 18: Arpita industrial trainingppt

JSP JSP DIRECTIVE ELEMENTS: The JSP directives are messages that tells

the web container how to translate a JSP page into the corresponding servlet.

There are three types of directives: page directive include directive taglib directive

Page 19: Arpita industrial trainingppt

JSP JSP page Directive: The page directive defines attributes that

apply to an entire JSP page. Syntax of JSP page directive: <%@ page attribute="value" %> Attributes of JSP page directive: import extends session pageEncoding errorPage

Page 20: Arpita industrial trainingppt

JSP JSP include directive: The include directive is used to include the

contents of any resource it may be jsp file, html file or text file.

Advantage of include directive: Code Reusability

Syntax of include directive: <%@ include file="resourceName" %>

Page 21: Arpita industrial trainingppt

JDBC Java JDBC(Java Database Connectivity) is a

java API to connect and execute query with the database. JDBC API uses jdbc drivers to connect with the database.

Page 22: Arpita industrial trainingppt

JDBC 5 steps to connect to the

database in JAVA: There are 5 steps to connect any java

application with the database in java using JDBC. They are as follows:

o Register the driver classo Creating connectiono Creating statemento Executing querieso Closing connection

Page 23: Arpita industrial trainingppt

JDBCRegister the Driver Class using

JDBC driver on MySQL: Class.forName(“com.mysql.jdbc.driver");  

o Create the connection object with the MySQL database:

Connection con=DriverManager.getConnection( “jdbc:mysql://localhost:3306/database_name”,”username”,”password”);  

Page 24: Arpita industrial trainingppt

JDBCCreate the Statement object: Statement stmt=con.createStatement();

o Execute the query:ResultSet rs=stmt.executeQuery("select * from 

emp");  while(rs.next()){  System.out.println(rs.getInt(1)+" "+rs.getString

(2)); }  

Page 25: Arpita industrial trainingppt

JDBCClose the connection object:

con.close();

Page 26: Arpita industrial trainingppt

PROPOSED ARCHITECTURE OF WEB APPLICATIONS

Presentation Layer (JSP, HTML)

Logic Layer (Servlets, JavaBeans etc)

Data Store Layer (MySQL, SQL Server, File System)

Page 27: Arpita industrial trainingppt

THREE TIER ARCHITECTURE Applied to web applications and distributed

programming, the three logical tiers usually correspond to the physical separation between three types of devices or hosts:

Browser or GUI Application Web Server or Application Server Database Server (often an RDBMS or

Relational Database)

Page 28: Arpita industrial trainingppt

THREE TIER ARCHITECTURE However, inside of the application server,

there is a further division of program code into three logical tiers. In a classic JSP/Servlet system, these objects are usually implemented as:

JSPs or Servlets responsible for creating HTML user interface pages

Servlets  responsible for business logic Servlets, or Java classes responsible for data

access. These objects usually use JDBC to query the database.

Page 29: Arpita industrial trainingppt

THREE TIER ARCHITECTURE

Page 30: Arpita industrial trainingppt

PROJECT ASSIGNED Title of the Project: Online Banking

Technologies used: Front End: JSP (Presentation Layer) Back End: Servlets (Application Layer) Database: MySQL (Database Layer)

Tools Used: IDE: NetBeans 8.0.2 Web Server: Apache-Tomcat-8.0.23

Duration: 2 months

Page 31: Arpita industrial trainingppt

CONCLUSION OF TRAINING I learnt the concepts and syntax of the

JSP/Servlets Programming.

During the course, I also came across several unknown logics which later be used in other projects.

Page 32: Arpita industrial trainingppt

Thank You