SlideShare a Scribd company logo
1 of 53
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

More Related Content

What's hot (20)

Java Virtual Machine (JVM), Difference JDK, JRE & JVM
Java Virtual Machine (JVM), Difference JDK, JRE & JVMJava Virtual Machine (JVM), Difference JDK, JRE & JVM
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
 
Ajax
AjaxAjax
Ajax
 
Core java complete ppt(note)
Core java  complete  ppt(note)Core java  complete  ppt(note)
Core java complete ppt(note)
 
Jdbc Ppt
Jdbc PptJdbc Ppt
Jdbc Ppt
 
ReactJS presentation.pptx
ReactJS presentation.pptxReactJS presentation.pptx
ReactJS presentation.pptx
 
Hibernate Presentation
Hibernate  PresentationHibernate  Presentation
Hibernate Presentation
 
Jdbc ppt
Jdbc pptJdbc ppt
Jdbc ppt
 
Java basic tutorial by sanjeevini india
Java basic tutorial by sanjeevini indiaJava basic tutorial by sanjeevini india
Java basic tutorial by sanjeevini india
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 
Jdbc architecture and driver types ppt
Jdbc architecture and driver types pptJdbc architecture and driver types ppt
Jdbc architecture and driver types ppt
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
 
JavaFX Presentation
JavaFX PresentationJavaFX Presentation
JavaFX Presentation
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 
Java EE Introduction
Java EE IntroductionJava EE Introduction
Java EE Introduction
 
Mvc architecture
Mvc architectureMvc architecture
Mvc architecture
 
Model View Controller (MVC)
Model View Controller (MVC)Model View Controller (MVC)
Model View Controller (MVC)
 
Jsp lifecycle
Jsp   lifecycleJsp   lifecycle
Jsp lifecycle
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Java interfaces
Java interfacesJava interfaces
Java interfaces
 

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

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 javaArshit Rai
 
Summer training java
Summer training javaSummer training java
Summer training javaArshit Rai
 
Enterprise application developement
Enterprise application developementEnterprise application developement
Enterprise application developementArchana Jha
 
Introduction to java_ee
Introduction to java_eeIntroduction to java_ee
Introduction to java_eeYogesh Bindwal
 
Course syllabus from ingenious
Course syllabus from ingeniousCourse syllabus from ingenious
Course syllabus from ingeniousColege Buz
 
Course syllabus from ingenious
Course syllabus from ingeniousCourse syllabus from ingenious
Course syllabus from ingeniousColege 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 eeRanjan Kumar
 
Google App Engine At A Glance
Google App Engine At A GlanceGoogle App Engine At A Glance
Google App Engine At A GlanceStefan Christoph
 
J2EE and layered architecture
J2EE and layered architectureJ2EE and layered architecture
J2EE and layered architectureSuman Behara
 
Intorduction to struts
Intorduction to strutsIntorduction to struts
Intorduction to strutsAnup72
 
Session 1 Tp1
Session 1 Tp1Session 1 Tp1
Session 1 Tp1phanleson
 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts frameworks4al_com
 
Java Web Programming [6/9] : MVC
Java Web Programming [6/9] : MVCJava Web Programming [6/9] : MVC
Java Web Programming [6/9] : MVCIMC Institute
 

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)
 
Summer training java
Summer training javaSummer training java
Summer training java
 
Summer training java
Summer training javaSummer training java
Summer training java
 
J2 ee architecture
J2 ee architectureJ2 ee architecture
J2 ee architecture
 
Virtual classroom
Virtual classroomVirtual classroom
Virtual classroom
 
Enterprise application developement
Enterprise application developementEnterprise application developement
Enterprise application developement
 
Introduction to java_ee
Introduction to java_eeIntroduction to java_ee
Introduction to java_ee
 
Course syllabus from ingenious
Course syllabus from ingeniousCourse syllabus from ingenious
Course syllabus from ingenious
 
Course syllabus from ingenious
Course syllabus from ingeniousCourse syllabus from ingenious
Course syllabus from ingenious
 
J2EE and Servlet
J2EE and Servlet J2EE and Servlet
J2EE and Servlet
 
Asif
AsifAsif
Asif
 
Introduction to java ee
Introduction to java eeIntroduction to java ee
Introduction to java ee
 
Google App Engine At A Glance
Google App Engine At A GlanceGoogle App Engine At A Glance
Google App Engine At A Glance
 
J2EE and layered architecture
J2EE and layered architectureJ2EE and layered architecture
J2EE and layered architecture
 
Intorduction to struts
Intorduction to strutsIntorduction to struts
Intorduction to struts
 
Session 1 Tp1
Session 1 Tp1Session 1 Tp1
Session 1 Tp1
 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts framework
 
Java EE 7 - Overview and Status
Java EE 7  - Overview and StatusJava EE 7  - Overview and Status
Java EE 7 - Overview and Status
 
Websphere - overview and introduction
Websphere - overview and introduction Websphere - overview and introduction
Websphere - overview and introduction
 
Java Web Programming [6/9] : MVC
Java Web Programming [6/9] : MVCJava Web Programming [6/9] : MVC
Java Web Programming [6/9] : MVC
 

More from IMC Institute

นิตยสาร Digital Trends ฉบับที่ 14
นิตยสาร Digital Trends ฉบับที่ 14นิตยสาร Digital Trends ฉบับที่ 14
นิตยสาร Digital Trends ฉบับที่ 14IMC 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 2019IMC Institute
 
บทความ The evolution of AI
บทความ The evolution of AIบทความ The evolution of AI
บทความ The evolution of AIIMC 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.12IMC Institute
 
เพราะเหตุใด Digitization ไม่ตอบโจทย์ Digital Transformation
เพราะเหตุใด Digitization ไม่ตอบโจทย์ Digital Transformationเพราะเหตุใด Digitization ไม่ตอบโจทย์ Digital Transformation
เพราะเหตุใด Digitization ไม่ตอบโจทย์ Digital TransformationIMC 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 WorkIMC 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.11IMC Institute
 
แนวทางการทำ Digital transformation
แนวทางการทำ Digital transformationแนวทางการทำ Digital transformation
แนวทางการทำ Digital transformationIMC Institute
 
บทความ The New Silicon Valley
บทความ The New Silicon Valleyบทความ The New Silicon Valley
บทความ The New Silicon ValleyIMC Institute
 
นิตยสาร IT Trends ของ IMC Institute ฉบับที่ 10
นิตยสาร IT Trends ของ  IMC Institute  ฉบับที่ 10นิตยสาร IT Trends ของ  IMC Institute  ฉบับที่ 10
นิตยสาร IT Trends ของ IMC Institute ฉบับที่ 10IMC Institute
 
แนวทางการทำ Digital transformation
แนวทางการทำ Digital transformationแนวทางการทำ Digital transformation
แนวทางการทำ Digital transformationIMC 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 2016IMC 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.orgIMC Institute
 
บทความ Big Data จากบล็อก thanachart.org
บทความ Big Data จากบล็อก thanachart.orgบทความ Big Data จากบล็อก thanachart.org
บทความ Big Data จากบล็อก thanachart.orgIMC Institute
 
กลยุทธ์ 5 ด้านกับการทำ Digital Transformation
กลยุทธ์ 5 ด้านกับการทำ Digital Transformationกลยุทธ์ 5 ด้านกับการทำ Digital Transformation
กลยุทธ์ 5 ด้านกับการทำ Digital TransformationIMC Institute
 

More from IMC Institute (20)

นิตยสาร Digital Trends ฉบับที่ 14
นิตยสาร Digital Trends ฉบับที่ 14นิตยสาร Digital Trends ฉบับที่ 14
นิตยสาร Digital Trends ฉบับที่ 14
 
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
 
บทความ The evolution of AI
บทความ The evolution of AIบทความ The evolution of AI
บทความ The evolution of AI
 
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
 
เพราะเหตุใด Digitization ไม่ตอบโจทย์ Digital Transformation
เพราะเหตุใด Digitization ไม่ตอบโจทย์ Digital Transformationเพราะเหตุใด Digitization ไม่ตอบโจทย์ Digital Transformation
เพราะเหตุใด Digitization ไม่ตอบโจทย์ Digital Transformation
 
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
 
มูลค่าตลาดดิจิทัลไทย 3 อุตสาหกรรม
มูลค่าตลาดดิจิทัลไทย 3 อุตสาหกรรมมูลค่าตลาดดิจิทัลไทย 3 อุตสาหกรรม
มูลค่าตลาดดิจิทัลไทย 3 อุตสาหกรรม
 
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
 
แนวทางการทำ Digital transformation
แนวทางการทำ Digital transformationแนวทางการทำ Digital transformation
แนวทางการทำ Digital transformation
 
บทความ The New Silicon Valley
บทความ The New Silicon Valleyบทความ The New Silicon Valley
บทความ The New Silicon Valley
 
นิตยสาร IT Trends ของ IMC Institute ฉบับที่ 10
นิตยสาร IT Trends ของ  IMC Institute  ฉบับที่ 10นิตยสาร IT Trends ของ  IMC Institute  ฉบับที่ 10
นิตยสาร IT Trends ของ IMC Institute ฉบับที่ 10
 
แนวทางการทำ Digital transformation
แนวทางการทำ Digital transformationแนวทางการทำ Digital transformation
แนวทางการทำ Digital transformation
 
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)
 
บทความ Robotics แนวโน้มใหม่สู่บริการเฉพาะทาง
บทความ Robotics แนวโน้มใหม่สู่บริการเฉพาะทาง บทความ Robotics แนวโน้มใหม่สู่บริการเฉพาะทาง
บทความ Robotics แนวโน้มใหม่สู่บริการเฉพาะทาง
 
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
 
Thailand software & software market survey 2016
Thailand software & software market survey 2016Thailand software & software market survey 2016
Thailand software & software market survey 2016
 
Developing Business Blockchain Applications on Hyperledger
Developing Business  Blockchain Applications on Hyperledger Developing Business  Blockchain Applications on Hyperledger
Developing Business Blockchain Applications on Hyperledger
 
Digital transformation @thanachart.org
Digital transformation @thanachart.orgDigital transformation @thanachart.org
Digital transformation @thanachart.org
 
บทความ Big Data จากบล็อก thanachart.org
บทความ Big Data จากบล็อก thanachart.orgบทความ Big Data จากบล็อก thanachart.org
บทความ Big Data จากบล็อก thanachart.org
 
กลยุทธ์ 5 ด้านกับการทำ Digital Transformation
กลยุทธ์ 5 ด้านกับการทำ Digital Transformationกลยุทธ์ 5 ด้านกับการทำ Digital Transformation
กลยุทธ์ 5 ด้านกับการทำ Digital Transformation
 

Recently uploaded

Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe中 央社
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...FIDO Alliance
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!Memoori
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...CzechDreamin
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfFIDO Alliance
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfSrushith Repakula
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfFIDO Alliance
 
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPTiSEO AI
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessUXDXConf
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsLeah Henrickson
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...panagenda
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceSamy Fodil
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfFIDO Alliance
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?Mark Billinghurst
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfFIDO Alliance
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaCzechDreamin
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty SecureFemke de Vroome
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfUK Journal
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Hiroshi SHIBATA
 

Recently uploaded (20)

Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
 

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 thananum@gmail.com www.facebook.com/imcinstitute www.imcinstitute.com 53