java web application development environmentdblab.sangji.ac.kr/downloads/dbp/java web application...

Post on 14-Jun-2020

0 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

your name

Java Web ApplicationsDevelopment Environment

Database Lab., Sangji Univ.상지대학교데이터베이스연구실

your name

Contents

• Chapter 1 : JSP and Servlet – Overview• Chapter 2 : Apache Web Server• Chapter 3 : Apache Tomcat• Chapter 4 : Tomcat Connector • Chapter 5 : Sample JSP and Servlet Project• Chapter 6 : Oracle• Chapter 7 : Sample JDBC program

your name

CHAPTER 1

JSP and ServletGetting Started

your name

Introduction of Web Applications(1)

• Web Server and Client

Web Client

Http Request

Http Request

Requested HTML page

Web Server

Web Application Server

Internet

Run and Generatethe HTML document

your name

Introduction of Web Applications(2)

• Web Application Server– Java EE Standard

• Zeus, Tmaxsoft, Korea, 2012, 07• WebLogic, Oracle, U.S.A., 2007. 06• Web Sphere, IBM• Glassfish, Oracle, U.S.A., 2011. 07

– Non Standard• Apache Tomcat (Open Source Foundation)

your name

Introduction of Web Applications(3)• Servlet vs. JSP

– Servlet• a Java-based server-side web technology• a Java Applet that runs on a server instead of a browser

– JSP(Java Server Page)• JSP is a similar to PHP, but it uses Java language• a high-level abstraction of Java servlets.• JSPs are translated into servlets at runtime• each JSP's servlet is cached and re-used until the original

JSP is modified

Servlet JSP

your name

Introduction of Web Applications(4)• Development Process of Servlet

Design and Coding

Compile

Java Class(servlet)

register to Web Container(Web.xml)

Web ClientPage Request

Web Server Web Application Server

servlet init

servlet 1

servlet 2

servlet n

your name

Introduction of Web Applications(5)• Development Process of JSP

Design and CodingWeb Application Server

place to JSP page to the web server directory

Web ClientPage Request

Web Server

JSP page request

your name

Introduction of Web Applications(6)

• Database Applications with JSP and Servlet

Web Server(WAS server)

Database ServerWeb Client

JSP and ServletDevelopment

Desktop

Database SchemaDevelopment

Desktop

your name

Introduction of Web Applications(7)

• Database Applications with JSP and Servlet– Integrating Servlets and JSP Pages

JSP Model 2 Architecture(Model View Controller)http://goo.gl/vGKOh

your name

Introduction of Web Applications(8)

• Summary– Web server and application server

• Apache – httpd.apache.org– (httpd-2.2.22-win32-x86-openssl-0.9.8t.msi)

• Apache tomcat server– tomcat.apache.org

– Database Server• Oracle database 11gR2

– Desktop Development Tools• Eclipse Juno

your name

CHAPTER 2Apache Web Server

your name

Apache Web Server• most popular web server

– a project of The Apache Software Foundation• URL for download

– httpd.apache.org– httpd-2.2.22-win32-x86-openssl-0.9.8t.msi (binary)

• open-source HTTP server for UNIX, Windows and other modern operating systems

• Apache http server : httpd

your name

Installation Apache Binary for win32

• Install Steps

your name

Configure the httpd

• Installed Products

your name

Configure your httpd.conf(1)

• httpd.conf– C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf

• Document Root# DocumentRoot: The directory out of which you will serve your# documents. By default, all requests are taken from this directory, but# symbolic links and aliases may be used to point to other locations.#DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs“

• Directory Index<IfModule dir_module>

DirectoryIndex index.html</IfModule>

• Error logErrorLog "logs/error.log"

your name

Configure your httpd.conf(2)

• User Directory in httpd.conf#LoadModule userdir_module modules/mod_userdir.so…# User home directories#Include conf/extra/httpd-userdir.conf

• conf/extra/httpd-userdir.conf# UserDir: The name of the directory that is appended onto a user's home# directory if a ~user request is received. Note that you must also set# the default access control for these directories, as in the example below.#UserDir "My Documents/My Website"

your name

Check your welcome page

• Monitor your web server and start

– C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\index.html

your name

Make your own web page• Using IDE tool for web page

• move the html file into – C:\Program Files\Apache Software Foundation\Apache2.2\htdocs

your name

Check your URL and page

• httpd://220.xxx.xxx.xx/myweb.html

• It works!

your name

CHAPTER 3Apache Tomcat

your name

Introduction to Apache Tomcat

• Apache Tomcat– Open source software implementation of the Java

Servlet and Java Server Page technologies

• Official URL– tomcat.apache.org– Binary Distribution

• 32-bit/64-bit Windows Service Installer• apache-tomcat-7.0.29.exe

your name

Installation of Apache Tomcat(1)• Configuration over the installation

Tomcat Port # and BasicsWelcome Screen

your name

Installation of Apache Tomcat(2)

• Configuration over the installation

Java Virtual Machine Path Tomcat Installation Directory

your name

Installation of Apache Tomcat(2)

• Install Products

your name

Configuration of Tomcat

• Tomcat Connection Test with 8080 port

your name

Configuration of Tomcat

• Set the new Environment Variable– CATALINA_HOME

• C:\Program Files\Apache Software Foundation\Tomcat 7.0

– CLASSPATH• .• C:\glassfish3\jdk7\lib\tools.jar• C:\Program Files\Apache Software Foundation\Tomcat 7.0\lib\jar-api.jar• C:\Program Files\Apache Software Foundation\Tomcat 7.0\lib\servlet-api.jar• C:\Program Files\Apache Software Foundation\Tomcat 7.0\bin\bootstrap.jar• C:\Program Files\Apache Software Foundation\Tomcat 7.0\bin\tomcat-juli.jar

your name

CHAPTER 4Tomcat Connector : mod_jk

your name

Tomcat Connector : mod_jk

• mod_jk– an Apache module– used to connect the Tomcat servlet container– with web servers(e.g., Apache)

Http Request mod_jk

your name

Tomcat Connector : mod_jk

• download– tomcat.apache.org

• Tomcat Connector JK 1.2– Binary Release for your installed Apache Server Version– tomcat-connectors-1.2.37-windows-i386-httpd-2.2.x.zip

• Extract the downloaded file and check the mod_jk.so– move the mod_jk.so file into

• C:\Program Files\Apache Software Foundation\Apache2.2\modules

your name

Configuration of Tomcat Connector(1)

• Documents for the “Impatient”– Quick Start How to– http://tomcat.apache.org/connectors-doc/generic_howto/quick.html

• Workers.properties– a mandatory file used by the web server– a minimum workers.properties, using just ajp13 to connect your

Apache webserver to the Tomcat engine– create a “wokrers.properties” in the

• “C:\Program Files\Apache Software Foundation\Apache2.2\conf”

your name

Configuration of Tomcat Connector(2)

• Minimum Apache Web Server Configuration– add or edit the following lines into the httpd.conf file

LoadModule jk_module modules/mod_jk.soDirectoryIndex index.html index.jsp index.htm# mod_jk setup<IfModule mod_jk.c>JkWorkersFile "C:\Program Files\Apache Group\Apache2.2\conf\workers.properties"JkLogFile "C:/Program Files\Apache Group\Apache2.2\logs\mod_jk.log"JkLogLevel infoJkLogStampFormat "[%a %b %H:%M:%S %Y]"JkMount /*.jsp dblabJkMount /servlet/* dblabJkMount /* dblab</IfModule>

• Restart the Apache and Tomcat server

your name

Test JSP Page for Apache and Tomcat• make the first JSP example file

• place the file into – C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\ROOT

• JSP test at your Web Browser

• What happen ?– http://220.xxx.xxx.xx

through the 8080 port through the 80 port

your name

CHAPTER 5

Make a sample JSP page and servlet by New Eclipse Project.Configure and place the files for web service

your name

Introduction to JSP and Servlet Development Environment

• Add a Server Runtime Environment– Apache Tomcat v7.0

• Create a new Dynamic Web Project

• Add your project into the server– create a relationship the server and your project

• Run Configurations– the launch configurations

your name

JSP Project Environment in Eclipse(1)

• The Server Architecture for Development

Web Server(WAS server)

Database ServerWeb Client

JSP and ServletDevelopment

Desktop

Database SchemaDevelopment

Desktop

Develop and Test at Here !

Test at Here ?

your name

JSP Project Environment in Eclipse(2)

• Add “Tomcat v7.0” as a new Runtime Environment– Window – Preference – Runtime Environment

your name

JSP Project Environment in Eclipse(3)

• In the “Server” tab,– define a new server

your name

Sample JSP in Eclipse : FirstJSP (1)

• Create a New Dynamic Web Project

your name

Sample JSP in Eclipse : FirstJSP (2)

• Written your JSP sample program

your name

Sample JSP in Eclipse : FirstJSP (3)

• Add your project into the server– Once you have created a server,– you need to create a relationship between the projects and your

server

your name

Sample JSP in Eclipse : FirstJSP (3)

• Run Configurations – Run -> Run configurations

your name

Sample JSP in Eclipse : FirstJSP (4)

• Run on the internal web browser– Run as -> Run on Server

• Test your JSP file on the real Apache Tomcat Server– copy your jsp file in Eclipse into tomcat server ROOT

• source : ………\workspace\FirstJSP\WebContent\FirstJSP.jsp• target : C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\ROOT\FirstJSP.jsp

your name

CHAPTER 5

Make a sample JSP page and servlet by New Eclipse Project.Configure and place the files for web service

your name

Sample Servlet in Eclipse : FirstServlet (1)

• Create a New Servlet File– <Java Resources> - new – Servlet

your name

Sample Servlet in Eclipse : FirstServlet (2)

• Write a Sample Servlet

your name

Sample Servlet in Eclipse : FirstServlet (3)

• Create a Run Configurations– server

• Tomcat v7.0

– source• src/test/servlet

your name

Sample Servlet in Eclipse : FirstServlet (4)

• Run on Eclipse– Run as – Run on Server

your name

Sample Servlet in Eclipse : FirstServlet (5)

• Run on the Real Apache Tomcat Server

Apache Tomcat ServerWeb Client

JSP and ServletDevelopment

Desktop

FirstServlet.class

your name

Sample Servlet in Eclipse : FirstServlet (6)

• Move your Java class file into the proper tomcat server directory– Your Java Class File

• \workspace\your project name\build\classes\package name\your java.class

or

http://hostname/mysample/servletname

http://hostname/servletname

your name

Sample Servlet in Eclipse : FirstServlet (7)

• Configure your web.xml– web.xml in the WEB-INF

web.xml

or

web.xml

your name

Sample Servlet in Eclipse : FirstServlet (8)

• Add <servlet-name> item into the web.xml

• Run your servlet on the web browsers

your name

CHAPTER 6

Oracle Database11gR2- Installation- Database Configuration Assistant- SQL*PLUS- SQL Developer- JDBC Connection

your name

Introduction to Oracle 11gR2(1)

• download URL– oracle.com

• documents for Oracle Products

your name

Introduction to Oracle 11gR2(2)• documents for Oracle Products

your name

Oracle Database 11gR2(1)

• download – oracle.com

• start the “oracle universal installer”

your name

Oracle Database 11gR2(2)

• Enterprise Edition

your name

Oracle Database 11gR2(3)

• Oracle Home and Environment

your name

Oracle Database 11gR2(4)

• Global Database Name• Oracle SID ; Oracle Instance ID

your name

Oracle Database 11gR2(5)

• Set the Character Set to Korean• Create Sample Database Schema

your name

Oracle Database 11gR2(6)

• Install

your name

Oracle Database 11gR2(7)

• Completion of Database Configuration Assistant– database control URL

• http://your hostname:1158/em

– password management

your name

Oracle Database 11gR2(8)

• Success the installation of Oracle 11gR2 on windows 7 32-bits

your name

CHAPTER 6

Oracle Database11gR2- Installation- Database Configuration Assistant- SQL*PLUS- SQL Developer- JDBC Connection

your name

Oracle Database 11gR2(9)• Installed Program Files

– DBCA DBCA(Database Configuration Assistant)

your name

Oracle Database 11gR2(10)• Installed Program Files

– Net Manager

Net Configuration Manger

Net Manager

your name

CHAPTER 6

Oracle Database11gR2- Installation- Database Configuration Assistant- SQL*PLUS- SQL Developer- JDBC Connection

your name

Oracle Database 11gR2(11)• Installed Program Files

– SQL Plus SQL Plus

your name

Oracle Database 11gR2(12)• Installed Program Files

– SQL Developer SQL Developer

your name

Oracle Database 11gR2(13)• Installed Program Files

– SQL Developer

New Database Connection Oracle Object Explorer

your name

Oracle Database 11gR2(14)• Installed Program Files

– SQL Developer

SQL Editor

your name

CHAPTER 6

Oracle Database11gR2- Installation- Database Configuration Assistant- SQL*PLUS- SQL Developer- JDBC Connection

your name

JDBC Connection(1)

• Install the JDBC Driver – supported JDBC Drivers by Oracle

• ojdbc5.jar• ojdbc6.jar

• Copy the jdbc driver files(.jar) (1) into the Apache Tomcat’s library directory

• source : D:\app\hostname\product\11.2.0\dbhome_1\jdbc\lib\ojdbc*.jar • target : C:\Program Files\Apache Software Foundation\Tomcat 7.0\lib

(2) into the Eclipse’s Project Library folder

your name

JDBC Connection(2)

• Make a Sample JDBC Connection JSP program

your name

JDBC Connection(3)

• Run a JDBC Connection JSP program– copy your jsp file into Apache Tomcat “webapps” directory

• Connect the URL – http://your_host/yourjspfile

your name

CHAPTER 7

Now, What to do ?

your name

Oracle Documentation Library

your name

JSP and Servlet with JDBC(1)

• Oracle Database– Documentation Library

your name

JSP and Servlet with JDBC(2)

• JDBC Developer’s Guide– Contents page

top related