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)

Python/Flask Presentation
Python/Flask PresentationPython/Flask Presentation
Python/Flask Presentation
 
Java: GUI
Java: GUIJava: GUI
Java: GUI
 
Jsp ppt
Jsp pptJsp ppt
Jsp ppt
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
React workshop
React workshopReact workshop
React workshop
 
Java 8 Lambda Expressions
Java 8 Lambda ExpressionsJava 8 Lambda Expressions
Java 8 Lambda Expressions
 
Java Spring Framework
Java Spring FrameworkJava Spring Framework
Java Spring Framework
 
Dotnet Frameworks Version History
Dotnet Frameworks Version HistoryDotnet Frameworks Version History
Dotnet Frameworks Version History
 
Php Presentation
Php PresentationPhp Presentation
Php Presentation
 
ASP, ASP.NET, JSP, COM/DCOM
ASP, ASP.NET, JSP, COM/DCOMASP, ASP.NET, JSP, COM/DCOM
ASP, ASP.NET, JSP, COM/DCOM
 
Asp.net mvc 5 ppt
Asp.net mvc 5 pptAsp.net mvc 5 ppt
Asp.net mvc 5 ppt
 
Express js
Express jsExpress js
Express js
 
Front end web development
Front end web developmentFront end web development
Front end web development
 
React native
React nativeReact native
React native
 
Angularjs PPT
Angularjs PPTAngularjs PPT
Angularjs PPT
 
Angular
AngularAngular
Angular
 
Jsp(java server pages)
Jsp(java server pages)Jsp(java server pages)
Jsp(java server pages)
 
Nodejs presentation
Nodejs presentationNodejs presentation
Nodejs presentation
 
Introduction Node.js
Introduction Node.jsIntroduction Node.js
Introduction Node.js
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
 

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

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 

Recently uploaded (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 

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