Sei sulla pagina 1di 18

JAVA EE 7 WEB

FRONT
I N S T R U C TO R : M R T.T G O TO R A
C O N TAC T: 0 7 1 8 0 0 2 4 9 7 / 0 7 7 9 2 0 6 7 2 0
EMAIL: tatenda.gotora/trust.gotora@yahoo.com

COURSE OUTLINE
Web Architecture
Developing with JSP
JAX-RS Web Services
HTML5 Applications with JavaScript and AJAX
Web Socket and the Java API for JSO Processing

WEB ARCHITECTURE
Client/Server Architecture
Client sends request to server
Server receives and process requests
Client process and renders the response
Server returns response and logging

JAVA EE ARCHITETURE [1]

JAVA EE ARCHITETURE
JAVA EE Container

Functionality

Web Container

Executing of web components

EJB Container

Running application logic

Data Tier

Storing application data

PROCTOLS
HTTP/HTTPS
File Transfer Protocol (FTP)
Telnet
POP3
Simple Mail Transfer Protocol (SMTP)

MARK UP LANGUAGES
HTML
XHTML
XML

TYPES OF WEB PAGES


Static Web Pages e.g. HTML
Dynamic Web Pages e.g. JSP
Responsive Web Pages- e.g. JavaScript

JAVA SERVLETS
Java object that processes the server side of HTTP interactions.
i.e. implementing the request/response interaction.
javax.servlet.http.HttpServlet API to be extended by all
javax.servlet.http.HttpServletRequest API used for request
javax.servlet.http.HttpServletResponse API used for response

JAVA SERVLETS OPERATIONS


Examine request header
Read request body
Gather data to send back
Set response header
Write response body

Web Archive (WAR) File Structure


WEB-INF/root web resources e.g. JSP pages
WEB-INF/classes java classes e.g. servlets
WEB-INF/lib code libraries e.g. servlet-api.jar
WEB-INF/web.xml Deployment info

Java Server Pages


Java servlet turned inside out
Create content for dynamic HTML website
Allows Java code to be embedded within static content
Regular Java code embedded in <% %> braces
Access to the Java servlet and JSP APIs

Java Server Pages vs. Servlet[1]

JSP Runtime
Web container reads the JSP before processing request
Generates the Java code for Java servlet
Compiles the generated Java servlet
Invokes the request that the client intended for the JSP
static content is wrapped out.println() statement
Java code wrote in sequence in generated Java servlet

Example
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.Date" %>
<%@page import="java.text.SimpleDateFormat" %>
<!DOCTYPE html>
<html>
<head>
<title>JSP Clock</title>
</head>
<body><div align='center'><br/>Hello there!<br/><br/>

Example Cont
It's been <%=System.currentTimeMillis()%> milliseconds
since midnight, January 1st 1970.
<br/><br/>
In other words, its
<%
Date now = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("EEEEEEEE");
String today = sdf.format(now);
out.println(today.trim()); %></div></body></html>

JSP Directives
page general properties e.g. output and import statements
taglib use of special tags from a tag library
include borrow content of another file

REFERENCES
1) Java EE The Big Picture: Mastering Code, Applications and
Frameworks of Java Platform EE & by Dr. Danny Coward
2) www.infiniteskills.com accessed online[16 September 2016]

Potrebbero piacerti anche