SlideShare a Scribd company logo
Module 1: Introduction to
   Web Application


  Thanisa Krauwaisayawan
   Thanachart Numnonda
   www.imcinstitute.com
Objectives
   Evolution of Enterprise Application Frameworks
   Overview: Java EE
   Web application, components and Web container
   Web application development and deployment steps
   Building Simple Web Applications using Eclipse and Tomcat
   Web Application Archive (*.WAR file)
       *.WAR directory structure
       WEB-INF subdirectory
   Deploying WAR file to Server



                                                                2
Evolution of Enterprise Application
            Framework
   Single tier
   Two tier
   Three tier
       –    RPC based
       –    Remote object based
   Three tier (HTML browser and Web server)
   Proprietary and standard application server

                                                  3
Single Tier (Mainframe-based)




   Dumb terminals are directly connected to
    mainframe
   Centralized model (as opposed distributed model)
   Presentation, business logic, and data access are
    intertwined in one monolithic mainframe
    application
                                                        4
Two-Tier
                        SQL
                        request
                                      Database
                        SQL
                        response




 Fat   clients talking to back end database
      SQL queries sent, raw data returned
   Presentation,Business logic and Data Model
    processing logic in client application

                                                 5
Three-Tier (RPC based)

                                           SQL
                   RPC request             request
                                                          Database
                   RPC response            SQL
                                           response

   Thinner client: business & data model separated from
    presentation
      Business logic and data access logic reside in middle tier
       server while client handles presentation
   Middle tier server is now required to handle system services
      Concurrency control, threading, transaction, security,
       persistence, multiplexing, performance, etc.
                                                                     6
Three-Tier (Remote Object based)
                                            SQL
                   Object request           request
                                                       Database
                   Object                  SQL
                   response                response



   Business logic and data model captured in objects
    – Business logic and data model are now described in
      “abstraction” (interface language)
   Object models used: CORBA, RMI, DCOM
       Interface language in CORBA is IDL
       Interface language in RMI is Java interface
                                                                  7
Three-Tier (Web Server)

                               WEB      SQL
               HTML request             request
                               Server
                                                   Database
               HTML response            SQL
                                        response




   Browser handles presentation logic
   Browser talks Web server via HTTP protocol
   Business logic and data model are handled by
    “dynamic contents generation” technologies (CGI,
    Servlet/JSP, ASP)
                                                              8
Proprietary and Standard Solution
   Comlexity at the middle tier server still remains
   Duplicate system services still need to be provided for
    the majority of enterprise applications
       –   Concurrency control, Transactions
       –   Load-balancing, Security
       –   Resource management, Connection pooling
   How to solve this problem?
       –   Commonly shared container that handles the
           above system services
       –   Proprietary versus standard based
JavaTM 2 Platform
                          Java Platform Micro Edition
                                   (Java ME)



 Optional
 Packages

               Optional
               Packages



                             Personal       Personal
  Java         Java         Basis Profile    Profile
Enterprise   Standard
 Edition      Edition         Foundation Profile       MIDP
(Java EE)    (Java SE)
                                        CDC                    Java
                                                       CLDC    Card

                      JVM                              KVM    Card VM

                                                                        10
Overview: Java EE

 Java EE is Java SE plus a large number of
  serverside APIs, containers and tools.
 Web Tier to Go With Java EE 6
       –   Servlet 3.0 (JSR 315)
       –   JavaServer Pages 2.2 (JSR 245)
   Many other subsystems standardized under a
    single platform
          EJB, JPA, JMS, JavaMail API, …
                                                 11
Java EE is End-to-End Solution
         Firewall
                         Java EE
                        Application
               Client     Server

                                                          Enterprise
                                        Enterprise       Information
                                       JavaBeans™
               Client                                   Systems (EIS):
Client                                                    Relational
                                                          Database,
                          Web           Enterprise         Legacy
Client                   Server         JavaBeans        Applications,
                         JSP,
                        Servlets                        ERP Systems
Client
             HTML/XML
                                      Other Services:
                                        JNDI, JMS,       Enterprise
         Client         Middle          JavaMail™       Information
          Tier           Tier                                Tier
                                                                         12
Web Server




             13
Web Components & Container
Applet Container                                  Web Container                                          EJB Container

    Applet                   HTTP/          JSP               Servlet
                             HTTPS                                                    RMI                       EJB

        J2SE




                                                                    RMI/IIOP
                                                                                                                JavaMail




                                                                                                                           RMI/IIOP
                                                         JavaMail




                                                                                                                                      JDBC
                                                                               JDBC
                                            JMS
                                     JNDI



                                                   JTA




                                                                                            JNDI

                                                                                                   JMS

                                                                                                          JTA
    App Client
    Container                                              JAF                                                   JAF
      App      HTTP/
     Client    HTTPS
                                                     J2SE

                                                     RMI
               RMI/IIOP

                          JDBC
 JNDI
        JMS




         J2SE                                                                                             J2SE




                                                                                                         Database
                                                                                                                                             14
Web Components & Container
   Web components are in the form of either Servlet or
    JSP (along with JavaBean's and custom tags)
   Web components run in a Web container
        Tomcat is a popular web containers
        All Java EE compliant app servers (GlassFish App Server)
         provide web containers
   Web container provides system services to Web
    components
        Request dispatching, security, and life cycle management
Components/Containers Handle
    Components            Containers
      Handle               Handle
   Presentation        Concurrency
   Business Logic      Security
                        Availability
                        Scalability
                        Persistence
                        Transaction
                        Life-cycle
                         management
                        Management
                                        16
Some definitions of the Web
            Development Process
   Web Page:
       simple text file consisting of text and HTML tags
   Web Browser:
       connects to a Web Server, sends a request for a page and
        receives and displays the result
       interprets HTML tags to display the page exactly the way
        the designer wanted it to be
   Web Server:
       software which can respond to a Web browser’s request for
        a page and then send that page to the browser

                                                                    17
Web Application & Components
   Web Application is a deployable package
       Web components (Servlets and JSP's)
       Static resource files such as images
       Helper classes
       Libraries
       Deployment descriptor (web.xml file)

   Web Application can be represented as
       A hierarchy of directories and files (unpacked form) or
       *.WAR file reflecting the same hierarchy (packed form)
                                                                  18
1. Create Development Tree Structure
 KeepWeb application source separate from
 compiled files
    –    facilitate iterative development
 Root   directory
    –    src: Java source of servlets and JavaBeans
         components
    –    WebContent: JSP pages and HTML pages,
         images

                                                      19
2. Create any static resources
 HTML    pages
     welcomePage.html
 Imagefiles that are used by HTML pages or
 JSP pages
     Example: dukeWaving.png




                                              20
3. Create deployment descriptor
           (web.xml)
 Deployment descriptor contains
 deployment time runtime instructions to the
 Web container
     URL that the client uses to access the web
      component
 Every web application has to have it
 For Servlet 3.0, web.xml is optional.
                                                   21
4. Build the Web application
   Build process is made of
      create build directory (if it is not present) and its
       subdirectories
      compile Java code into build/classes directory




                                                               22
Example: Hello Tree Structure
    Hello
    – build/classes
          •   ResultServlet.class
    –   src
          •   ResultServlet.java
    –   WebContent
          •   WEB-INF
          •   META-INF
          •   welcomePage.html
          •   dukeWaving.png
                                    23
5. Deploy Web application
   Deploy the application over deployment platform
    such as Sun Java System App Server or Tomcat




                                                      24
6. Perform Client Access to Web
           Application
 From a browser, go to URN of the Web
 application




                                         25
Tool: Eclipse 3.7.2




                      26
New > Server > Apache Tomcat 7.0




                                   27
New Dynamic Web Project




                          28
Choose Project Name: Hello and Specify Location




                                                  29
Drag image into Hello




                        30
New HTML File




                31
welcomePage.html




                   32
welcomePage.html

<html>
    <head>
        <title>Hello</title>
    </head>
    <body>
        <form action="result">
            <img src="dukeWaving.png" width="79" height="62"
   /><br>
            <h3> Hello, my name is Duke. What's yours?
   <br><br></h3>
            <input type="text" name="username" /><br><br>
            <input type="submit" value="Submit" />
            <input type="reset" value="Reset" />
        </form>
    </body>
</html>




                                                               33
http://localhost:8080/Hello/welcomePage.html




                                               34
New Servlet…




               35
ResultServlet.java




                     36
ResultServlet.java
protected void doGet(HttpServletRequest request,
   HttpServletResponse response)
    throws ServletException, IOException {

        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();

        String username = request.getParameter("username");
        out.print("<h3> Hello " + username + "</h3>");

        out.close();
}




                                                              37
Test & Result




                38
Web Application
 Web  application can be deployed in two
 different forms
     a *.war file or
     an unpacked directory laid out in the same format
      as a *.war file (build directory)
 Use*.war file when you have to deploy on
 a remote machine

                                                          39
What is *.WAR file?
   Ready to deploy'able package over web container
   Similar to *.jar file
   Contains things to be deployed
        Web components (servlets or JSP's)
        Server-side utility classes
        Static Web presentation content (HTML, image, etc)
        Client-side classes (applets and utility classes)
   Reflects contents in build directory
                                                              40
Document Root & Context
   Document Root of the Web application
       Top-level directory of WAR
       Contains JSP pages, client-side classes and archives, and
        static Web resources are stored
       Also contains WEB-INF directory
   A context is a name that gets mapped to the
    document root of a Web application
       /Hello is context for Hello example
       Distinguishes a Web application in a single Web container
       Has to be specified as part of client URN
                                                                    41
Export to Hello.WAR file




                           42
Directory Structure of *.WAR file




                                    43
WEB-INF Directory
   Subdirectory of Document root
   Contains
       web.xml : Web application deployment descriptor
       JSP tag library descriptor files
       classes : A directory that contains server-side classes:
        servlets, utility classes, and JavaBeans components
       lib : A directory that contains JAR archives of libraries
        (tag libraries and any utility libraries called by server-side
        classes)

                                                                         44
HTTP request URL & Web component
          URN (alias) & Context
   Request URL: User specified access point of a web
    resource
      http://[host]:[port]/[request path]?[query string]
      [request path] is made of context and web component's URN
      http://localhost:8080/Hello/result?username=Thanisa

   Context: Name of the root document of a web
    application – Identifies a particular application on that
    server
        /Hello is context

                                                                   45
Configuring Web Application
 Configuration
             information is specified in
 web.xml (Web Applications Deployment
 Descriptor)




                                           46
Alias Paths (of web.xml)
   When a request is received by Servlet container, it must
    determine which Web component in a which web
    application should handle the request. It does so by
    mapping the URL path contained in the request to a Web
    component
   A URL path contains the context root and alias path
        http://<host>:8080/context_root/alias_path
   Alias Path can be in the form of either
        /alias-string (for servlet) or
        /*.jsp (for JSP)
                                                               47
<?xml version="1.0" encoding="UTF-8"?>
:
    <servlet>
        <servlet-name>ResultServlet</servlet-name>
        <servlet-class>servlets.ResultServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>ResultServlet</servlet-name>
        <url-pattern>/result</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
       <welcome-file>
            welcomePage.html
        </welcome-file>
    </welcome-file-list>
</web-app>

                                                                48
Try to deploy in external Tomcat




                                   49
Control Panel -> Administrative Tools ->
                Services




                                           50
http://localhost:8080/Hello/welcomePage.html




                                               51
Acknowledgement
Some contents are borrowed from the
presentation slides of Sang Shin, Java™
Technology Evangelist, Sun Microsystems,
Inc.




                                           52
Thank you

   thananum@gmail.com
www.facebook.com/imcinstitute
   www.imcinstitute.com



                                53
Ad

More Related Content

What's hot (20)

Servlets
ServletsServlets
Servlets
Geethu Mohan
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)
slire
 
Spring Boot and REST API
Spring Boot and REST APISpring Boot and REST API
Spring Boot and REST API
07.pallav
 
JDBC – Java Database Connectivity
JDBC – Java Database ConnectivityJDBC – Java Database Connectivity
JDBC – Java Database Connectivity
Information Technology
 
Threads in JAVA
Threads in JAVAThreads in JAVA
Threads in JAVA
Haldia Institute of Technology
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
Arulmurugan Rajaraman
 
Introduction to Java Programming Language
Introduction to Java Programming LanguageIntroduction to Java Programming Language
Introduction to Java Programming Language
jaimefrozr
 
Java
JavaJava
Java
s4al_com
 
Spring data jpa
Spring data jpaSpring data jpa
Spring data jpa
Jeevesh Pandey
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
ivpol
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
Purbarun Chakrabarti
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
Tanmoy Barman
 
Php with MYSQL Database
Php with MYSQL DatabasePhp with MYSQL Database
Php with MYSQL Database
Computer Hardware & Trouble shooting
 
JavaFX Overview
JavaFX OverviewJavaFX Overview
JavaFX Overview
José Maria Silveira Neto
 
Java 8 Lambda Built-in Functional Interfaces
Java 8 Lambda Built-in Functional InterfacesJava 8 Lambda Built-in Functional Interfaces
Java 8 Lambda Built-in Functional Interfaces
Ganesh Samarthyam
 
Spring Core
Spring CoreSpring Core
Spring Core
Pushan Bhattacharya
 
Jdbc ppt
Jdbc pptJdbc ppt
Jdbc ppt
Vikas Jagtap
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
Anjan Banda
 
Java 8 Lambda Expressions
Java 8 Lambda ExpressionsJava 8 Lambda Expressions
Java 8 Lambda Expressions
Scott Leberknight
 
Maven Introduction
Maven IntroductionMaven Introduction
Maven Introduction
Sandeep Chawla
 

Similar to Java Web Programming [1/9] : Introduction to Web Application (20)

Intro in JavaEE world (TU Olomouc)
Intro in JavaEE world (TU Olomouc)Intro in JavaEE world (TU Olomouc)
Intro in JavaEE world (TU Olomouc)
blahap
 
Summer training java
Summer training javaSummer training java
Summer training java
Arshit Rai
 
Summer training java
Summer training javaSummer training java
Summer training java
Arshit Rai
 
J2 ee architecture
J2 ee architectureJ2 ee architecture
J2 ee architecture
saurabhshertukde
 
Virtual classroom
Virtual classroomVirtual classroom
Virtual classroom
Krishna Chaithanya
 
Enterprise application developement
Enterprise application developementEnterprise application developement
Enterprise application developement
Archana Jha
 
Introduction to java_ee
Introduction to java_eeIntroduction to java_ee
Introduction to java_ee
Yogesh Bindwal
 
Course syllabus from ingenious
Course syllabus from ingeniousCourse syllabus from ingenious
Course syllabus from ingenious
Colege Buz
 
Course syllabus from ingenious
Course syllabus from ingeniousCourse syllabus from ingenious
Course syllabus from ingenious
Colege Buz
 
J2EE and Servlet
J2EE and Servlet J2EE and Servlet
J2EE and Servlet
Rishikesh .
 
Asif
AsifAsif
Asif
Shaik Asif
 
Introduction to java ee
Introduction to java eeIntroduction to java ee
Introduction to java ee
Ranjan Kumar
 
Google App Engine At A Glance
Google App Engine At A GlanceGoogle App Engine At A Glance
Google App Engine At A Glance
Stefan Christoph
 
J2EE and layered architecture
J2EE and layered architectureJ2EE and layered architecture
J2EE and layered architecture
Suman Behara
 
Intorduction to struts
Intorduction to strutsIntorduction to struts
Intorduction to struts
Anup72
 
Session 1 Tp1
Session 1 Tp1Session 1 Tp1
Session 1 Tp1
phanleson
 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts framework
s4al_com
 
Java EE 7 - Overview and Status
Java EE 7  - Overview and StatusJava EE 7  - Overview and Status
Java EE 7 - Overview and Status
Java Usergroup Berlin-Brandenburg
 
Websphere - overview and introduction
Websphere - overview and introduction Websphere - overview and introduction
Websphere - overview and introduction
Vibrant Technologies & Computers
 
Java Web Programming [6/9] : MVC
Java Web Programming [6/9] : MVCJava Web Programming [6/9] : MVC
Java Web Programming [6/9] : MVC
IMC Institute
 
Intro in JavaEE world (TU Olomouc)
Intro in JavaEE world (TU Olomouc)Intro in JavaEE world (TU Olomouc)
Intro in JavaEE world (TU Olomouc)
blahap
 
Summer training java
Summer training javaSummer training java
Summer training java
Arshit Rai
 
Summer training java
Summer training javaSummer training java
Summer training java
Arshit Rai
 
Enterprise application developement
Enterprise application developementEnterprise application developement
Enterprise application developement
Archana Jha
 
Introduction to java_ee
Introduction to java_eeIntroduction to java_ee
Introduction to java_ee
Yogesh Bindwal
 
Course syllabus from ingenious
Course syllabus from ingeniousCourse syllabus from ingenious
Course syllabus from ingenious
Colege Buz
 
Course syllabus from ingenious
Course syllabus from ingeniousCourse syllabus from ingenious
Course syllabus from ingenious
Colege Buz
 
J2EE and Servlet
J2EE and Servlet J2EE and Servlet
J2EE and Servlet
Rishikesh .
 
Introduction to java ee
Introduction to java eeIntroduction to java ee
Introduction to java ee
Ranjan Kumar
 
Google App Engine At A Glance
Google App Engine At A GlanceGoogle App Engine At A Glance
Google App Engine At A Glance
Stefan Christoph
 
J2EE and layered architecture
J2EE and layered architectureJ2EE and layered architecture
J2EE and layered architecture
Suman Behara
 
Intorduction to struts
Intorduction to strutsIntorduction to struts
Intorduction to struts
Anup72
 
Session 1 Tp1
Session 1 Tp1Session 1 Tp1
Session 1 Tp1
phanleson
 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts framework
s4al_com
 
Java Web Programming [6/9] : MVC
Java Web Programming [6/9] : MVCJava Web Programming [6/9] : MVC
Java Web Programming [6/9] : MVC
IMC Institute
 
Ad

More from IMC Institute (20)

นิตยสาร Digital Trends ฉบับที่ 14
นิตยสาร Digital Trends ฉบับที่ 14นิตยสาร Digital Trends ฉบับที่ 14
นิตยสาร Digital Trends ฉบับที่ 14
IMC Institute
 
Digital trends Vol 4 No. 13 Sep-Dec 2019
Digital trends Vol 4 No. 13  Sep-Dec 2019Digital trends Vol 4 No. 13  Sep-Dec 2019
Digital trends Vol 4 No. 13 Sep-Dec 2019
IMC Institute
 
บทความ The evolution of AI
บทความ The evolution of AIบทความ The evolution of AI
บทความ The evolution of AI
IMC Institute
 
IT Trends eMagazine Vol 4. No.12
IT Trends eMagazine  Vol 4. No.12IT Trends eMagazine  Vol 4. No.12
IT Trends eMagazine Vol 4. No.12
IMC Institute
 
เพราะเหตุใด Digitization ไม่ตอบโจทย์ Digital Transformation
เพราะเหตุใด Digitization ไม่ตอบโจทย์ Digital Transformationเพราะเหตุใด Digitization ไม่ตอบโจทย์ Digital Transformation
เพราะเหตุใด Digitization ไม่ตอบโจทย์ Digital Transformation
IMC Institute
 
IT Trends 2019: Putting Digital Transformation to Work
IT Trends 2019: Putting Digital Transformation to WorkIT Trends 2019: Putting Digital Transformation to Work
IT Trends 2019: Putting Digital Transformation to Work
IMC Institute
 
มูลค่าตลาดดิจิทัลไทย 3 อุตสาหกรรม
มูลค่าตลาดดิจิทัลไทย 3 อุตสาหกรรมมูลค่าตลาดดิจิทัลไทย 3 อุตสาหกรรม
มูลค่าตลาดดิจิทัลไทย 3 อุตสาหกรรม
IMC Institute
 
IT Trends eMagazine Vol 4. No.11
IT Trends eMagazine  Vol 4. No.11IT Trends eMagazine  Vol 4. No.11
IT Trends eMagazine Vol 4. No.11
IMC Institute
 
แนวทางการทำ Digital transformation
แนวทางการทำ Digital transformationแนวทางการทำ Digital transformation
แนวทางการทำ Digital transformation
IMC Institute
 
บทความ The New Silicon Valley
บทความ The New Silicon Valleyบทความ The New Silicon Valley
บทความ The New Silicon Valley
IMC Institute
 
นิตยสาร IT Trends ของ IMC Institute ฉบับที่ 10
นิตยสาร IT Trends ของ  IMC Institute  ฉบับที่ 10นิตยสาร IT Trends ของ  IMC Institute  ฉบับที่ 10
นิตยสาร IT Trends ของ IMC Institute ฉบับที่ 10
IMC Institute
 
แนวทางการทำ Digital transformation
แนวทางการทำ Digital transformationแนวทางการทำ Digital transformation
แนวทางการทำ Digital transformation
IMC Institute
 
The Power of Big Data for a new economy (Sample)
The Power of Big Data for a new economy (Sample)The Power of Big Data for a new economy (Sample)
The Power of Big Data for a new economy (Sample)
IMC Institute
 
บทความ Robotics แนวโน้มใหม่สู่บริการเฉพาะทาง
บทความ Robotics แนวโน้มใหม่สู่บริการเฉพาะทาง บทความ Robotics แนวโน้มใหม่สู่บริการเฉพาะทาง
บทความ Robotics แนวโน้มใหม่สู่บริการเฉพาะทาง
IMC Institute
 
IT Trends eMagazine Vol 3. No.9
IT Trends eMagazine  Vol 3. No.9 IT Trends eMagazine  Vol 3. No.9
IT Trends eMagazine Vol 3. No.9
IMC Institute
 
Thailand software & software market survey 2016
Thailand software & software market survey 2016Thailand software & software market survey 2016
Thailand software & software market survey 2016
IMC Institute
 
Developing Business Blockchain Applications on Hyperledger
Developing Business  Blockchain Applications on Hyperledger Developing Business  Blockchain Applications on Hyperledger
Developing Business Blockchain Applications on Hyperledger
IMC Institute
 
Digital transformation @thanachart.org
Digital transformation @thanachart.orgDigital transformation @thanachart.org
Digital transformation @thanachart.org
IMC Institute
 
บทความ Big Data จากบล็อก thanachart.org
บทความ Big Data จากบล็อก thanachart.orgบทความ Big Data จากบล็อก thanachart.org
บทความ Big Data จากบล็อก thanachart.org
IMC Institute
 
กลยุทธ์ 5 ด้านกับการทำ Digital Transformation
กลยุทธ์ 5 ด้านกับการทำ Digital Transformationกลยุทธ์ 5 ด้านกับการทำ Digital Transformation
กลยุทธ์ 5 ด้านกับการทำ Digital Transformation
IMC Institute
 
นิตยสาร Digital Trends ฉบับที่ 14
นิตยสาร Digital Trends ฉบับที่ 14นิตยสาร Digital Trends ฉบับที่ 14
นิตยสาร Digital Trends ฉบับที่ 14
IMC Institute
 
Digital trends Vol 4 No. 13 Sep-Dec 2019
Digital trends Vol 4 No. 13  Sep-Dec 2019Digital trends Vol 4 No. 13  Sep-Dec 2019
Digital trends Vol 4 No. 13 Sep-Dec 2019
IMC Institute
 
บทความ The evolution of AI
บทความ The evolution of AIบทความ The evolution of AI
บทความ The evolution of AI
IMC Institute
 
IT Trends eMagazine Vol 4. No.12
IT Trends eMagazine  Vol 4. No.12IT Trends eMagazine  Vol 4. No.12
IT Trends eMagazine Vol 4. No.12
IMC Institute
 
เพราะเหตุใด Digitization ไม่ตอบโจทย์ Digital Transformation
เพราะเหตุใด Digitization ไม่ตอบโจทย์ Digital Transformationเพราะเหตุใด Digitization ไม่ตอบโจทย์ Digital Transformation
เพราะเหตุใด Digitization ไม่ตอบโจทย์ Digital Transformation
IMC Institute
 
IT Trends 2019: Putting Digital Transformation to Work
IT Trends 2019: Putting Digital Transformation to WorkIT Trends 2019: Putting Digital Transformation to Work
IT Trends 2019: Putting Digital Transformation to Work
IMC Institute
 
มูลค่าตลาดดิจิทัลไทย 3 อุตสาหกรรม
มูลค่าตลาดดิจิทัลไทย 3 อุตสาหกรรมมูลค่าตลาดดิจิทัลไทย 3 อุตสาหกรรม
มูลค่าตลาดดิจิทัลไทย 3 อุตสาหกรรม
IMC Institute
 
IT Trends eMagazine Vol 4. No.11
IT Trends eMagazine  Vol 4. No.11IT Trends eMagazine  Vol 4. No.11
IT Trends eMagazine Vol 4. No.11
IMC Institute
 
แนวทางการทำ Digital transformation
แนวทางการทำ Digital transformationแนวทางการทำ Digital transformation
แนวทางการทำ Digital transformation
IMC Institute
 
บทความ The New Silicon Valley
บทความ The New Silicon Valleyบทความ The New Silicon Valley
บทความ The New Silicon Valley
IMC Institute
 
นิตยสาร IT Trends ของ IMC Institute ฉบับที่ 10
นิตยสาร IT Trends ของ  IMC Institute  ฉบับที่ 10นิตยสาร IT Trends ของ  IMC Institute  ฉบับที่ 10
นิตยสาร IT Trends ของ IMC Institute ฉบับที่ 10
IMC Institute
 
แนวทางการทำ Digital transformation
แนวทางการทำ Digital transformationแนวทางการทำ Digital transformation
แนวทางการทำ Digital transformation
IMC Institute
 
The Power of Big Data for a new economy (Sample)
The Power of Big Data for a new economy (Sample)The Power of Big Data for a new economy (Sample)
The Power of Big Data for a new economy (Sample)
IMC Institute
 
บทความ Robotics แนวโน้มใหม่สู่บริการเฉพาะทาง
บทความ Robotics แนวโน้มใหม่สู่บริการเฉพาะทาง บทความ Robotics แนวโน้มใหม่สู่บริการเฉพาะทาง
บทความ Robotics แนวโน้มใหม่สู่บริการเฉพาะทาง
IMC Institute
 
IT Trends eMagazine Vol 3. No.9
IT Trends eMagazine  Vol 3. No.9 IT Trends eMagazine  Vol 3. No.9
IT Trends eMagazine Vol 3. No.9
IMC Institute
 
Thailand software & software market survey 2016
Thailand software & software market survey 2016Thailand software & software market survey 2016
Thailand software & software market survey 2016
IMC Institute
 
Developing Business Blockchain Applications on Hyperledger
Developing Business  Blockchain Applications on Hyperledger Developing Business  Blockchain Applications on Hyperledger
Developing Business Blockchain Applications on Hyperledger
IMC Institute
 
Digital transformation @thanachart.org
Digital transformation @thanachart.orgDigital transformation @thanachart.org
Digital transformation @thanachart.org
IMC Institute
 
บทความ Big Data จากบล็อก thanachart.org
บทความ Big Data จากบล็อก thanachart.orgบทความ Big Data จากบล็อก thanachart.org
บทความ Big Data จากบล็อก thanachart.org
IMC Institute
 
กลยุทธ์ 5 ด้านกับการทำ Digital Transformation
กลยุทธ์ 5 ด้านกับการทำ Digital Transformationกลยุทธ์ 5 ด้านกับการทำ Digital Transformation
กลยุทธ์ 5 ด้านกับการทำ Digital Transformation
IMC Institute
 
Ad

Recently uploaded (20)

Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5..."Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
Fwdays
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Datastucture-Unit 4-Linked List Presentation.pptx
Datastucture-Unit 4-Linked List Presentation.pptxDatastucture-Unit 4-Linked List Presentation.pptx
Datastucture-Unit 4-Linked List Presentation.pptx
kaleeswaric3
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Image processinglab image processing image processing
Image processinglab image processing  image processingImage processinglab image processing  image processing
Image processinglab image processing image processing
RaghadHany
 
Leading AI Innovation As A Product Manager - Michael Jidael
Leading AI Innovation As A Product Manager - Michael JidaelLeading AI Innovation As A Product Manager - Michael Jidael
Leading AI Innovation As A Product Manager - Michael Jidael
Michael Jidael
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
"PHP and MySQL CRUD Operations for Student Management System"
"PHP and MySQL CRUD Operations for Student Management System""PHP and MySQL CRUD Operations for Student Management System"
"PHP and MySQL CRUD Operations for Student Management System"
Jainul Musani
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko
Fwdays
 
Salesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docxSalesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docx
José Enrique López Rivera
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5..."Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
Fwdays
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Datastucture-Unit 4-Linked List Presentation.pptx
Datastucture-Unit 4-Linked List Presentation.pptxDatastucture-Unit 4-Linked List Presentation.pptx
Datastucture-Unit 4-Linked List Presentation.pptx
kaleeswaric3
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Image processinglab image processing image processing
Image processinglab image processing  image processingImage processinglab image processing  image processing
Image processinglab image processing image processing
RaghadHany
 
Leading AI Innovation As A Product Manager - Michael Jidael
Leading AI Innovation As A Product Manager - Michael JidaelLeading AI Innovation As A Product Manager - Michael Jidael
Leading AI Innovation As A Product Manager - Michael Jidael
Michael Jidael
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
"PHP and MySQL CRUD Operations for Student Management System"
"PHP and MySQL CRUD Operations for Student Management System""PHP and MySQL CRUD Operations for Student Management System"
"PHP and MySQL CRUD Operations for Student Management System"
Jainul Musani
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko
Fwdays
 
Salesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docxSalesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docx
José Enrique López Rivera
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 

Java Web Programming [1/9] : Introduction to Web Application

  • 1. Module 1: Introduction to Web Application Thanisa Krauwaisayawan Thanachart Numnonda www.imcinstitute.com
  • 2. Objectives  Evolution of Enterprise Application Frameworks  Overview: Java EE  Web application, components and Web container  Web application development and deployment steps  Building Simple Web Applications using Eclipse and Tomcat  Web Application Archive (*.WAR file)  *.WAR directory structure  WEB-INF subdirectory  Deploying WAR file to Server 2
  • 3. Evolution of Enterprise Application Framework  Single tier  Two tier  Three tier – RPC based – Remote object based  Three tier (HTML browser and Web server)  Proprietary and standard application server 3
  • 4. Single Tier (Mainframe-based)  Dumb terminals are directly connected to mainframe  Centralized model (as opposed distributed model)  Presentation, business logic, and data access are intertwined in one monolithic mainframe application 4
  • 5. Two-Tier SQL request Database SQL response  Fat clients talking to back end database  SQL queries sent, raw data returned  Presentation,Business logic and Data Model processing logic in client application 5
  • 6. Three-Tier (RPC based) SQL RPC request request Database RPC response SQL response  Thinner client: business & data model separated from presentation  Business logic and data access logic reside in middle tier server while client handles presentation  Middle tier server is now required to handle system services  Concurrency control, threading, transaction, security, persistence, multiplexing, performance, etc. 6
  • 7. Three-Tier (Remote Object based) SQL Object request request Database Object SQL response response  Business logic and data model captured in objects – Business logic and data model are now described in “abstraction” (interface language)  Object models used: CORBA, RMI, DCOM  Interface language in CORBA is IDL  Interface language in RMI is Java interface 7
  • 8. Three-Tier (Web Server) WEB SQL HTML request request Server Database HTML response SQL response  Browser handles presentation logic  Browser talks Web server via HTTP protocol  Business logic and data model are handled by “dynamic contents generation” technologies (CGI, Servlet/JSP, ASP) 8
  • 9. Proprietary and Standard Solution  Comlexity at the middle tier server still remains  Duplicate system services still need to be provided for the majority of enterprise applications – Concurrency control, Transactions – Load-balancing, Security – Resource management, Connection pooling  How to solve this problem? – Commonly shared container that handles the above system services – Proprietary versus standard based
  • 10. JavaTM 2 Platform Java Platform Micro Edition (Java ME) Optional Packages Optional Packages Personal Personal Java Java Basis Profile Profile Enterprise Standard Edition Edition Foundation Profile MIDP (Java EE) (Java SE) CDC Java CLDC Card JVM KVM Card VM 10
  • 11. Overview: Java EE  Java EE is Java SE plus a large number of serverside APIs, containers and tools.  Web Tier to Go With Java EE 6 – Servlet 3.0 (JSR 315) – JavaServer Pages 2.2 (JSR 245)  Many other subsystems standardized under a single platform  EJB, JPA, JMS, JavaMail API, … 11
  • 12. Java EE is End-to-End Solution Firewall Java EE Application Client Server Enterprise Enterprise Information JavaBeans™ Client Systems (EIS): Client Relational Database, Web Enterprise Legacy Client Server JavaBeans Applications, JSP, Servlets ERP Systems Client HTML/XML Other Services: JNDI, JMS, Enterprise Client Middle JavaMail™ Information Tier Tier Tier 12
  • 14. Web Components & Container Applet Container Web Container EJB Container Applet HTTP/ JSP Servlet HTTPS RMI EJB J2SE RMI/IIOP JavaMail RMI/IIOP JavaMail JDBC JDBC JMS JNDI JTA JNDI JMS JTA App Client Container JAF JAF App HTTP/ Client HTTPS J2SE RMI RMI/IIOP JDBC JNDI JMS J2SE J2SE Database 14
  • 15. Web Components & Container  Web components are in the form of either Servlet or JSP (along with JavaBean's and custom tags)  Web components run in a Web container  Tomcat is a popular web containers  All Java EE compliant app servers (GlassFish App Server) provide web containers  Web container provides system services to Web components  Request dispatching, security, and life cycle management
  • 16. Components/Containers Handle Components Containers Handle Handle  Presentation  Concurrency  Business Logic  Security  Availability  Scalability  Persistence  Transaction  Life-cycle management  Management 16
  • 17. Some definitions of the Web Development Process  Web Page:  simple text file consisting of text and HTML tags  Web Browser:  connects to a Web Server, sends a request for a page and receives and displays the result  interprets HTML tags to display the page exactly the way the designer wanted it to be  Web Server:  software which can respond to a Web browser’s request for a page and then send that page to the browser 17
  • 18. Web Application & Components  Web Application is a deployable package  Web components (Servlets and JSP's)  Static resource files such as images  Helper classes  Libraries  Deployment descriptor (web.xml file)  Web Application can be represented as  A hierarchy of directories and files (unpacked form) or  *.WAR file reflecting the same hierarchy (packed form) 18
  • 19. 1. Create Development Tree Structure  KeepWeb application source separate from compiled files – facilitate iterative development  Root directory – src: Java source of servlets and JavaBeans components – WebContent: JSP pages and HTML pages, images 19
  • 20. 2. Create any static resources  HTML pages  welcomePage.html  Imagefiles that are used by HTML pages or JSP pages  Example: dukeWaving.png 20
  • 21. 3. Create deployment descriptor (web.xml)  Deployment descriptor contains deployment time runtime instructions to the Web container  URL that the client uses to access the web component  Every web application has to have it  For Servlet 3.0, web.xml is optional. 21
  • 22. 4. Build the Web application  Build process is made of  create build directory (if it is not present) and its subdirectories  compile Java code into build/classes directory 22
  • 23. Example: Hello Tree Structure  Hello – build/classes • ResultServlet.class – src • ResultServlet.java – WebContent • WEB-INF • META-INF • welcomePage.html • dukeWaving.png 23
  • 24. 5. Deploy Web application  Deploy the application over deployment platform such as Sun Java System App Server or Tomcat 24
  • 25. 6. Perform Client Access to Web Application  From a browser, go to URN of the Web application 25
  • 27. New > Server > Apache Tomcat 7.0 27
  • 28. New Dynamic Web Project 28
  • 29. Choose Project Name: Hello and Specify Location 29
  • 30. Drag image into Hello 30
  • 33. welcomePage.html <html> <head> <title>Hello</title> </head> <body> <form action="result"> <img src="dukeWaving.png" width="79" height="62" /><br> <h3> Hello, my name is Duke. What's yours? <br><br></h3> <input type="text" name="username" /><br><br> <input type="submit" value="Submit" /> <input type="reset" value="Reset" /> </form> </body> </html> 33
  • 37. ResultServlet.java protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); String username = request.getParameter("username"); out.print("<h3> Hello " + username + "</h3>"); out.close(); } 37
  • 39. Web Application  Web application can be deployed in two different forms  a *.war file or  an unpacked directory laid out in the same format as a *.war file (build directory)  Use*.war file when you have to deploy on a remote machine 39
  • 40. What is *.WAR file?  Ready to deploy'able package over web container  Similar to *.jar file  Contains things to be deployed  Web components (servlets or JSP's)  Server-side utility classes  Static Web presentation content (HTML, image, etc)  Client-side classes (applets and utility classes)  Reflects contents in build directory 40
  • 41. Document Root & Context  Document Root of the Web application  Top-level directory of WAR  Contains JSP pages, client-side classes and archives, and static Web resources are stored  Also contains WEB-INF directory  A context is a name that gets mapped to the document root of a Web application  /Hello is context for Hello example  Distinguishes a Web application in a single Web container  Has to be specified as part of client URN 41
  • 43. Directory Structure of *.WAR file 43
  • 44. WEB-INF Directory  Subdirectory of Document root  Contains  web.xml : Web application deployment descriptor  JSP tag library descriptor files  classes : A directory that contains server-side classes: servlets, utility classes, and JavaBeans components  lib : A directory that contains JAR archives of libraries (tag libraries and any utility libraries called by server-side classes) 44
  • 45. HTTP request URL & Web component URN (alias) & Context  Request URL: User specified access point of a web resource  http://[host]:[port]/[request path]?[query string]  [request path] is made of context and web component's URN  http://localhost:8080/Hello/result?username=Thanisa  Context: Name of the root document of a web application – Identifies a particular application on that server  /Hello is context 45
  • 46. Configuring Web Application  Configuration information is specified in web.xml (Web Applications Deployment Descriptor) 46
  • 47. Alias Paths (of web.xml)  When a request is received by Servlet container, it must determine which Web component in a which web application should handle the request. It does so by mapping the URL path contained in the request to a Web component  A URL path contains the context root and alias path  http://<host>:8080/context_root/alias_path  Alias Path can be in the form of either  /alias-string (for servlet) or  /*.jsp (for JSP) 47
  • 48. <?xml version="1.0" encoding="UTF-8"?> : <servlet> <servlet-name>ResultServlet</servlet-name> <servlet-class>servlets.ResultServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>ResultServlet</servlet-name> <url-pattern>/result</url-pattern> </servlet-mapping> <session-config> <session-timeout> 30 </session-timeout> </session-config> <welcome-file-list> <welcome-file> welcomePage.html </welcome-file> </welcome-file-list> </web-app> 48
  • 49. Try to deploy in external Tomcat 49
  • 50. Control Panel -> Administrative Tools -> Services 50
  • 52. Acknowledgement Some contents are borrowed from the presentation slides of Sang Shin, Java™ Technology Evangelist, Sun Microsystems, Inc. 52
  • 53. Thank you [email protected] www.facebook.com/imcinstitute www.imcinstitute.com 53