Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Pptjava

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 15

ERODE SENGUNTHAR

ENGINEERING COLLEGE
JAVA-BASED APPROACH FOR
DEVELOPING WEB APPLICATION
SYSTEM

PRESENTED BY
DEPARTMENT OF M.TECH(CSE)
S.IMMANUEL
S.GUGHAN
B.GOKUL KRISHNAN
ABSTRACT:
• This paper adopts server-side Java programming model:
• Model-view-controller to contrast web-based shopping system framework.
Using servlets, Java server pages (JSPs) and JavaBean technologies, we provide
a standard, open, robust and cross-platform architecture. It can guarantee system-
independence. Presented framework provides a clean separation of presentation
from business logic which meets user's taste by changing user interface
frequenctly, and enables more functions to be conventiently added in future.
INTRODUCTION:

! Creating Internet, Intranet and Extranet applications are currently center of programming focus. They all
belong to web-based business applications that require database connection, user authentication, session
management and dynamic HTML generation.
• Web-based applications should have following features:
! Platform-independent on the client side, usually a browser.
! Platform-independent on the server side, such as including both Unix and Windows environments.
! Be able to connect to a variety of database, such as including Oracle, SQL server.
! Be able to run on different web servers, Apache, IIS and Java Web Server and other popular web
serves.
! Highly modular so that more functions can be added in the future.
! Easy to implement and low cost.
SERVER-SIDE JAVA PROGRAMMING MODEL :

• Server-side Java programming model is based on three recent Java server-side


technologies:
* Servlets.
* Java Server Pages (JSP)and JavaBean.
* Java server-side Architecture.
SERVLETS:
Servlets are web server extensions that respond to HTTP requires in the same way as CGI
programs.

JAVA SERVER PAGES(JSP):


JSPs are managed components that implement business logic and typically access
enterprise data, transactions, and applications. These technologies form the core of an open,
scalable, highly productive web architecture based on Java. In addition to the advantages of
Java as a programming language, such as Java's extensive class library and APIs support
network, distributed computing, messaging, transactions, database, security, and many other
functions essential for server programming.
JAVA SERVER-SIDE ARCHITECTURE :

To create Java Web application for business purpose, JavaBeans, JSP, and Servlets can be combined in the
following model-view-controller design pattern:

1) The user fills in an HTML form and clicks the Submit button, which posts the request to a Java
servlet (the controller). The servlet reads the input parameters and passes them to JavaBeans (the model) that
perform the business logic.
2) Based on the outcome of the business logic and the user profile, the servlet selects a JSP (the view)
and calls it to present the results.
3) The JSP extracts the results from the JavaBeans and merges them with the originally submitted
HTML form which is then returned to the user.
4) Web application system can be very effectively designed along the lines of the generic Model-
View-Controller architecture. In the next section, a electronic shopping system based on the model will be
discussed.
EXAMPLE SYSTEM :

* User Authentication Servlet.


* ProxyServer.
* QueryServlet.
* OrderFormServlet.
USER AUTHENTICATION SERVLET:

Http protocol is stateless which means that a web server could not associate information gathered from a user on one page with a
request by that the same user on another page.

 Without some state mechanism, a web-based electronic shopping system will never exist because it would forget who you are, or
what you had collected by the time you were ready to add a second item to your cart.

 A hybrid Cookie-Session method is adopted to achieve user authentication. A cookie is used to store the basic id, username and
clearance in an encrypted format. Additional data, like items collected in a shopping cart, is stored only in the session.

 All requests pass through authentication Servlet regardless of the URL. This servlet handles the authentication process roughly as
follows. Getting id, username, clearance and any necessary data directly from session if a valid session is found, else checking a valid
cookie, if found, decrypt cookie and copy user id, username and clearance into a new session.

 If having neither a valid session nor a cookie, then to ask user to login, register or admit them as a guest. The benefits using session,
we can implement fast authentication on every page, also can store large amounts of any type of data.
PROXYSERVER :

• ProxyServer is a servlet which maintains connection to many shopping mall database application server. Hashtable class is used to
store URLs of database servers distributed on Internet.

• In order to get the port numbers and host name for the location of the servers which database is placed, a little configuration file
should be created.

• Data of configuration is used in the "init" method that is called by the servlet engine when the servlet is first created. The "init"
method is called only once per servlet regardless of how many instances of the servlet are actually made.

• Once ProxyServer is configured, it waits for calls from another servlet. Another servlet Proxy (like Query Servlet) can make calls
directly on methods of ProxyServer which use the reference to JavaBeans for required data.

• PrixyServer uses some JavaBeans to Database Connectivity (JDBC) for connecting a database, JDBC provides database vender
independence.

• The JSP gets content through JavaBeans's properties and them into an HTML page which is sent to user.
QUERYSERVLET :

• QueryServlet handles user requests it receives from the web server. It formats user's
information into SQL language.
• Then it obtains a reference to the ProxyServer using the "getServletContext" and
"getServlet" methods from the servlet API.
• Once a ProxyServer is obtained, it can use the URL of the current request to decide which
database server it should be used to fulfill its requests.
• QueryServlet also can put user information into object, then pass this object to ProxyServer
which can get useful data from the database and return values also by a object.
ORDERFORMSERVLET :
• OrderformServlet is to deal with user order form. It tasks each form submission, package it up, and E-mail it to some shopping mall's
mail box on the Internet.
• Mailing text is just a matter of opening up a connection to a SMTP mail host and sending the message body to it. SMTP usually
resides on TCP port 25, and you can use the majority of mail hosts on the Internet.
• Opening up a connection to a port is perfored through sockets, and the Java API supports this very adequately. However, this can get a
little messy, especially if you don't really know how to format the text information which are gathered from user, so that the mailer can
interpret it correctly.
• Using the SmtpClient class from the servlet makes the whole process of sending an E-mail a easy task. Constructing a E-mail is a
matter of creating the header and the message body. Creating the message header is a matter of calling a set of methods that set up the
to ,from, and subject fields.
• When user decides to buy something, OrderFormServlet will get user's information through user database and order information from
order database, then package them in order to construct E-mail message body.
OUTCOME :
•Thank you

You might also like