What Are Java Servlets
What Are Java Servlets
Java Servlets
Servlets Advantages
Integration
Take advantages of all the Java technologies, JDBC,
Enterprise JavaBeans (EJB).
Efficiency
A single process that runs until the servlet-based
application is shut down.
Servlet Example
What is JSP?
Generate
Client
Response
Server
Execute
helloServlet.class
6
Processing phase
A simple example
Java Servlet & JSP
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWorld extends HttpServlet {
<HTML>
<HEAD>
<TITLE>Hello</TITLE>
</HEAD>
<BODY>
<H1>
<%
out.println("<HEAD><TITLE>Hello World</TITLE></HEAD>");
if (request.getParameter("name") == null)
out.println("<BODY>");
{
out.println("<BIG>Hello World</BIG>");
out.println("Hello World");
} else {
out.println("</BODY></HTML>");
out.println("Hello, " + request.getParameter("name"));
}
}
}
%>
7
</H1>
</BODY>
</HTML>
out.println("<HTML>");
Template Pages
Server Page Template
Resulting HTML
<html>
<html>
<title>
<title>
A simple example
A simple example
</title>
translation
</title>
<body color=#FFFFFF>
<body color=#FFFFFF>
</body>
</body>
</html>
</html>
ASP Technology
JSP Technology
Web Server
Platforms
Microsoft Windows
Reusable
components
No
Security against
System crashes
No
Yes
Scripting
Language
VBScript, Jscript
Java
10
<html>
<head><title>Hello World by JSP</title></head>
<body>
<font size=12>
<%
out.println("Hello INE2720 Students and the World!");
%>
</font>
</body>
11
Web Services
12
XML (Format)
Services
UDDI (Publish)
WSDL (Find)
A directory service
A protocol for
applications to find
a service
Network
SOAP (Bind)
A protocol that
enables
applications to
agree the
communication
The Internet
The Internet, using TCP/IP protocols
13
Service-Oriented Architecture
Find - UDDI
Requestor
Registry
Bind
WSDL, SOAP
Publish - UDDI
14
Provider
References
The End.
Thank you for your patience!
15