0% found this document useful (0 votes)
23 views5 pages

Java Server Pages (JSP) & Servlets: Web Development

This document provides an introduction to Java Server Pages (JSP) and Servlets for web development. It explains that static web pages are served directly by a web server in response to HTTP requests, but dynamic content and data storage require a "helper" application. JSP and Servlets allow embedding Java code in HTML pages to generate dynamic content. Servlets are Java classes that extend functionality of web servers. They are written, compiled, and deployed along with a deployment descriptor. When a browser requests a URL, the servlet is run by the web server to handle the request and generate the response. JSP pages simplify this by allowing Java code to be embedded in HTML using special tags rather than directly in the page.

Uploaded by

moralestp
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views5 pages

Java Server Pages (JSP) & Servlets: Web Development

This document provides an introduction to Java Server Pages (JSP) and Servlets for web development. It explains that static web pages are served directly by a web server in response to HTTP requests, but dynamic content and data storage require a "helper" application. JSP and Servlets allow embedding Java code in HTML pages to generate dynamic content. Servlets are Java classes that extend functionality of web servers. They are written, compiled, and deployed along with a deployment descriptor. When a browser requests a URL, the servlet is run by the web server to handle the request and generate the response. JSP pages simplify this by allowing Java code to be embedded in HTML using special tags rather than directly in the page.

Uploaded by

moralestp
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Java Server Pages (JSP) & Servlets

Web Development
Introduction – Serving Static Pages
HTTP Request
GET
…..
…..

<HTML>
<HEAD>
<HTML>
</HEAD>
<HEAD>
<HTML>
</HEAD>
<HEAD>
<BODY></HEAD>
HTTP Response ……..
<BODY>
</BODY>
……..
<BODY>
</HTML>
</BODY>
……..
<HTML> </HTML>
</BODY>
<HEAD> </HTML>
</HEAD>
Client Web Server
<BODY>
……..
</BODY>
</HTML>

The web server gets the


A web browser lets user request, finds the resource,
request a resource and returns it to user.
(HTML page, picture, sound)
But what if you want Dynamic Content &
Ability to Save Data on the Server?

Web Server
parameters

HTTP header info <HTML>


<HEAD>
<HTML> </HEAD>
<HEAD>
</HEAD>

<BODY>
web server <BODY>
…….. helper
</BODY>
……..
</BODY>
app </HTML> app
</HTML>

• Need some kind of “helper” app that can work with the server
• Helper apps is what does the work of generating dynamic content
• Helper app in the web server can be:
– JSP / Servlets (Java)
– ASP (Microsoft)
– “CGI” Program (Perl, Python, C)
– PHP
JSP = HTML + Java (sort of)
<HTML>
Class TimeIs {
<BODY>
void check() {
The current time is:
x = new Date();
XX:XX
}
</BODY>
}
</HTML>

<HTML>
<BODY>
The current time is:
<%= new
java.util.Date() %>
</BODY>
</HTML>

• Like putting Java into an HTML page (sort of).


• More like putting in labels that call real Java methods rather than embedding
actual Java code into the page.
Deploying and Running Servlet
1. Write Servlet
2. Create a Deployment Descriptor (DD)
3. Compile servlet
4. Copy compiled *.class file and DD to
appropriate directories
5. Launch browser and type in URL

You might also like