• No results found

Introduction to Web Applications using JSP, Servlets, Jstl and JQuery Workshop for ICOM5016

N/A
N/A
Protected

Academic year: 2021

Share "Introduction to Web Applications using JSP, Servlets, Jstl and JQuery Workshop for ICOM5016"

Copied!
30
0
0

Loading.... (view fulltext now)

Full text

(1)

MediaDB: A ICOM5016 project Requirements Setting Eclipse and Tomcat Examples Deploying a Web App to Tomcat

Introduction to Web Applications

using JSP, Servlets, Jstl and JQuery

Workshop for ICOM5016

Harold Valdivia Garcia

University of Puerto Rico, Mayaguez Campus

(2)

MediaDB: A ICOM5016 project Requirements Setting Eclipse and Tomcat Examples Deploying a Web App to Tomcat

Outline

1

MediaDB: A ICOM5016 project

2

Requirements

Your Attention

Web Server + Servlet Container (Tomcat)

Jstl (JSP Standard Tag Library) and JQuery

3

Setting Eclipse and Tomcat

4

Examples

WebApp Calculator

WebApp University

(3)

MediaDB: A ICOM5016 project

Requirements Setting Eclipse and Tomcat Examples Deploying a Web App to Tomcat

Outline

1

MediaDB: A ICOM5016 project

2

Requirements

Your Attention

Web Server + Servlet Container (Tomcat)

Jstl (JSP Standard Tag Library) and JQuery

3

Setting Eclipse and Tomcat

4

Examples

WebApp Calculator

WebApp University

(4)

MediaDB: A ICOM5016 project

Requirements Setting Eclipse and Tomcat Examples Deploying a Web App to Tomcat

MediaDB: A ICOM5016 project

(5)

MediaDB: A ICOM5016 project

Requirements

Setting Eclipse and Tomcat Examples Deploying a Web App to Tomcat

Web Server + Servlet Container (Tomcat) Jstl (JSP Standard Tag Library) and JQuery

Outline

1

MediaDB: A ICOM5016 project

2

Requirements

Your Attention

Web Server + Servlet Container (Tomcat)

Jstl (JSP Standard Tag Library) and JQuery

3

Setting Eclipse and Tomcat

4

Examples

WebApp Calculator

WebApp University

(6)

MediaDB: A ICOM5016 project

Requirements

Setting Eclipse and Tomcat Examples Deploying a Web App to Tomcat

Web Server + Servlet Container (Tomcat)

Jstl (JSP Standard Tag Library) and JQuery

W eb Server + Servlet Container (Tomcat)

Download Tomcat 6.0 from

Apache-Tomcat-Project

Unzip the file into your directory

”Tomcat-Dir”

(7)

MediaDB: A ICOM5016 project

Requirements

Setting Eclipse and Tomcat Examples Deploying a Web App to Tomcat

Web Server + Servlet Container (Tomcat)

Jstl (JSP Standard Tag Library) and JQuery

Jstl (JSP Standard Tag Library) and JQuery

Jstl is a collection of tags that implements programming

structures. Download Jstl from

here

(8)

MediaDB: A ICOM5016 project Requirements

Setting Eclipse and Tomcat

Examples Deploying a Web App to Tomcat

Outline

1

MediaDB: A ICOM5016 project

2

Requirements

Your Attention

Web Server + Servlet Container (Tomcat)

Jstl (JSP Standard Tag Library) and JQuery

3

Setting Eclipse and Tomcat

4

Examples

WebApp Calculator

WebApp University

(9)

MediaDB: A ICOM5016 project Requirements

Setting Eclipse and Tomcat

Examples Deploying a Web App to Tomcat

Setting Eclipse and Tomcat

Eclipse

Preference

Servers

Runtime

Environments→

Add

(10)

MediaDB: A ICOM5016 project Requirements

Setting Eclipse and Tomcat

Examples Deploying a Web App to Tomcat

Set the tomcat

directory

(11)

MediaDB: A ICOM5016 project Requirements Setting Eclipse and Tomcat

Examples

Deploying a Web App to Tomcat

WebApp Calculator WebApp University

Outline

1

MediaDB: A ICOM5016 project

2

Requirements

Your Attention

Web Server + Servlet Container (Tomcat)

Jstl (JSP Standard Tag Library) and JQuery

3

Setting Eclipse and Tomcat

4

Examples

WebApp Calculator

WebApp University

(12)

MediaDB: A ICOM5016 project Requirements Setting Eclipse and Tomcat

Examples

Deploying a Web App to Tomcat

WebApp Calculator

WebApp University

WebApp Calculator

This web application implements a very simple arithmetic

calculator. The user can sends two numbers and an operation

(+,-,/,*) and receives the results.

Download it from

here

Look it at here:

web-calc

(13)

MediaDB: A ICOM5016 project Requirements Setting Eclipse and Tomcat

Examples

Deploying a Web App to Tomcat

WebApp Calculator

WebApp University

WebApp Calculator

The Web app has the following

files:

Calculator.java

index.jsp

CalculatorServlet.java

calculator-result.jsp

(14)

MediaDB: A ICOM5016 project Requirements Setting Eclipse and Tomcat

Examples

Deploying a Web App to Tomcat

WebApp Calculator

WebApp University

WebApp Calculator

(15)

MediaDB: A ICOM5016 project Requirements Setting Eclipse and Tomcat

Examples

Deploying a Web App to Tomcat

WebApp Calculator

WebApp University

WebApp Calculator

(16)

MediaDB: A ICOM5016 project Requirements Setting Eclipse and Tomcat

Examples

Deploying a Web App to Tomcat

WebApp Calculator

WebApp University

WebApp Calculator

(17)

MediaDB: A ICOM5016 project Requirements Setting Eclipse and Tomcat

Examples

Deploying a Web App to Tomcat

WebApp Calculator

WebApp University

WebApp University

Considering the MVC pattern, This web app has three

components:

Models: Courses.java, Professor.java, etc (POJOs)

Views: index.jsp, courseViewer.jsp, etc

Controller: Servlets + CourseMgr.java, ProfessorMgr, etc

It uses embedded java code

It uses JSTL and JQuery

Download it from

here

(18)

MediaDB: A ICOM5016 project Requirements Setting Eclipse and Tomcat

Examples

Deploying a Web App to Tomcat

WebApp Calculator

WebApp University

Installing JSTL

Copy the jstl jar to:

(19)

MediaDB: A ICOM5016 project Requirements Setting Eclipse and Tomcat

Examples

Deploying a Web App to Tomcat

WebApp Calculator

WebApp University

Installing JSTL

Add the jars to the classpath:

Web-project

→Properties→Java Build Path

Libraries

Add

Jars

(20)

MediaDB: A ICOM5016 project Requirements Setting Eclipse and Tomcat

Examples

Deploying a Web App to Tomcat

WebApp Calculator

WebApp University

Embedded Java Code in JSP Pages

We have access to these objects: request, response, session

We can use Java and HTML.

(21)

MediaDB: A ICOM5016 project Requirements Setting Eclipse and Tomcat

Examples

Deploying a Web App to Tomcat

WebApp Calculator

WebApp University

Embedded Java Code in JSP Pages

(22)

MediaDB: A ICOM5016 project Requirements Setting Eclipse and Tomcat

Examples

Deploying a Web App to Tomcat

WebApp Calculator

WebApp University

JSTL: JSP Standard Tag Library

We will only use the

core library

(http://java.sun.com/jsp/jstl/core).

Here a good tutorial

(23)

MediaDB: A ICOM5016 project Requirements Setting Eclipse and Tomcat

Examples

Deploying a Web App to Tomcat

WebApp Calculator

WebApp University

JSTL: JSP Standard Tag Library

(24)

MediaDB: A ICOM5016 project Requirements Setting Eclipse and Tomcat

Examples

Deploying a Web App to Tomcat

WebApp Calculator

WebApp University

JQuery

Here

studentViewer.jsp

using JQuery

JQuery allows us to send background requests to the Web

Server.

JQuery allows us to receive asynchronous response from the

Web Server.

(25)

MediaDB: A ICOM5016 project Requirements Setting Eclipse and Tomcat

Examples

Deploying a Web App to Tomcat

WebApp Calculator

WebApp University

JQuery

(26)

MediaDB: A ICOM5016 project Requirements Setting Eclipse and Tomcat

Examples

Deploying a Web App to Tomcat

WebApp Calculator

WebApp University

JQuery

In the example, we want to add a link that retrieves the

student’s details

(27)

MediaDB: A ICOM5016 project Requirements Setting Eclipse and Tomcat

Examples

Deploying a Web App to Tomcat

WebApp Calculator

WebApp University

JQuery

(28)

MediaDB: A ICOM5016 project Requirements Setting Eclipse and Tomcat Examples

Deploying a Web App to Tomcat

Outline

1

MediaDB: A ICOM5016 project

2

Requirements

Your Attention

Web Server + Servlet Container (Tomcat)

Jstl (JSP Standard Tag Library) and JQuery

3

Setting Eclipse and Tomcat

4

Examples

WebApp Calculator

WebApp University

(29)

MediaDB: A ICOM5016 project Requirements Setting Eclipse and Tomcat Examples

Deploying a Web App to Tomcat

Deploying a Web App to Tomcat

Web-project

Export

WAR file

Uncheck the optimize option

Check Export source file

(30)

MediaDB: A ICOM5016 project Requirements Setting Eclipse and Tomcat Examples

Deploying a Web App to Tomcat

Deploying a Web App to Tomcat

Tomcat installation under ubuntu:

sudo apt-get install tomcat6

Deploying a war file to Tomcat:

Copy the war file into /full-path-tomcat/webapps/

sudo cp my-web-app.war /var/lib/tomcat6/webapps/

Browse your web app here:

References

Related documents

Return to the creek and hike through a terra firma forest for about 30 minutes until we arrive at the second parrot clay lick where, if the weather conditions permit, we will be

Nearly 19 percent of the licensed drivers in South Dakota were under 25, but 39.2 percent of the drinking drivers in fatal and injury accidents and 48.4 percent of the speeding

Students who can benefit from this course include experienced java programmers who require effective, real-world skill-building in Java Enterprise

Summary statistics for all relevant data elements (e.g., non-procedural and procedural time, QMP and staff time, intensity, total work values, service mix, number of patients

Nevertheless, the past is rarely forgotten, and while in official narratives specific facts tend to be excluded or even denied, usually certain members of the society – mem-

Following the taxonomy of the telemedicine systems, I was able to provide a unification of all transportation protocols making use of an instant messaging protocol for exchanging

Oleh yang demikian, adalah amat penting bagi sektor awam dan swasta untuk memilih corak pengagihan risiko yang sesuai dalam membuat keputusan yang

Satellite Type: In this type, the Toll Road Company benefits greatly from having more land to construct connecting roads, ensure easier selection of the type of