SlideShare a Scribd company logo
Introduction to
     Java Enterprise
         Edition

    Configuring JBoss within Eclipse
        
            Write your first Servlet

                       Fernando Gil
                   lobho.gil@gmail.com
                       Marzo 2012
Agenda


    How to configure JBoss AS within Eclipse in
    order to start the develop of JavaEE
    applications.

    We'll write our first Servlet class.

    We'll discuss the deployment descriptor.
JBoss AS 6.1 & Eclipse Indigo

        First download Eclipse IDE for Java Developers from:
        http://www.eclipse.org/downloads and JBoss 6.1 from:
        http://www.jboss.org/jbossas/downloads/

        Open Eclipse.

        Create a New Server:
    Go to File/New/Other
    



    Select Server Option
    



    Search JBoss 6.x
    



    Browse JBoss Home
    



    Directory (the folder
    where you saved
    JBoss)
    Click Finish
    
Important

        If you can not find JBoss 6.x in the servers list,
        try to Download additional server adapters:

    
     Sometimes eclipse can
    not find the JBoss
    adapters, in that case
    check this video tutorial
    to solve the problem:
    Eclipse & JBoss AS 6
Dynamic Web
         Project


    Open Eclipse and select File/New/
    Dynamic Web Project

    Set the Project Name and the
    location

    In Target Runtime we must select
    the runtime of JBoss 6.x

    The Dynamic web module version
    will be set automatically

    We can Click Finish
Creating our
          Servlet

    In order to keep the
    example simple, we'll
    create     a    servlet
    selecting
    File/New/Class and set
    the values like in the
    picture:
The Code
package com.dss.tut;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class FirstServlet extends HttpServlet {
      /* The service() method handles requests and creates responses.
       * The servlet container automatically calls this method when
       * it gets any request for this servlet.*/
      public void service(HttpServletRequest req, HttpServletResponse resp)
                   throws IOException, ServletException{
             PrintWriter pw = resp.getWriter();
           pw.println("<html>");
           pw.println(" <head></head>");
           pw.println(" <body>");
           pw.println(" <h1>Hello! this is my first
Servlet</h1>");
           pw.println(" </body>");
           pw.println("</html>");
      }
}
Deployment Descriptor

    We must indicate to the Application Server the configurations of our Servlets. The Deployment
    descriptor is a XML file to accomplish this task. We will talk more about this file later. By the moment
    we need to create a new file called web.xml in the directory: WebContent/WEB-INF of our project.

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xmlns="http://java.sun.com/xml/ns/javaee"
                  xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
                  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                  http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
                  id="WebApp_ID" version="3.0">

           <servlet>
                  <!-- Define our servlet indicating one name to identify it and
                         the class which represent it including the package -->
                  <servlet-name>First</servlet-name>
                  <servlet-class>com.dss.tut.FirstServlet</servlet-class>
           </servlet>
        <servlet-mapping>
           <!-- Link one existent servlet with an url. Whit this we can specify
                  the way we can access the Servlet by the browser-->
                  <servlet-name>First</servlet-name>
                  <url-pattern>/MyServlet</url-pattern>
           </servlet-mapping>
    </web-app>
Compilation and Deployment

    Now we just need to select our project, right click, Run As.., Run on Server,
    Select our JBoss Server and wait.

    Remember the url pattern that we specified in the deployment descriptor,
    because that is the way we'll access to the Servlet.
Next Lesson:
JPS Technology
         Fernando Gil
     lobho.gil@gmail.com
         Marzo 2012

More Related Content

What's hot

Deploying and running mule standalone
Deploying and running mule standaloneDeploying and running mule standalone
Deploying and running mule standalonemdfkhan625
 
Getting started with Selenium 2
Getting started with Selenium 2Getting started with Selenium 2
Getting started with Selenium 2Sebastiano Armeli
 
Testing Agile Web Services from soapUI
Testing Agile Web Services from soapUITesting Agile Web Services from soapUI
Testing Agile Web Services from soapUIPLM Mechanic .
 
Api webservice setupinstructions
Api webservice setupinstructionsApi webservice setupinstructions
Api webservice setupinstructionsShivaling Sannalli
 
JavaScript Testing VIA Selenium
JavaScript Testing VIA SeleniumJavaScript Testing VIA Selenium
JavaScript Testing VIA SeleniumAdam Christian
 
Idempotent filter in Mule
Idempotent filter in MuleIdempotent filter in Mule
Idempotent filter in MuleF K
 
Maven tools & archetypes
Maven tools & archetypesMaven tools & archetypes
Maven tools & archetypesSon Nguyen
 
Mule ESB - How to convert from Xml to Json in 5 minutes
Mule ESB - How to convert from Xml to Json in 5 minutesMule ESB - How to convert from Xml to Json in 5 minutes
Mule ESB - How to convert from Xml to Json in 5 minutesGennaro Spagnoli
 
Deploying and running in mule standalone
Deploying and running in mule standaloneDeploying and running in mule standalone
Deploying and running in mule standaloneAnirban Sen Chowdhary
 
Integration with Dropbox using Mule ESB
Integration with Dropbox using Mule ESBIntegration with Dropbox using Mule ESB
Integration with Dropbox using Mule ESBRupesh Sinha
 
Mule with drools
Mule with droolsMule with drools
Mule with droolsF K
 
The WordPress developer's toolkit
The WordPress developer's toolkit The WordPress developer's toolkit
The WordPress developer's toolkit Ivelina Dimova
 
Mule management console installation with Tomcat
Mule management console installation with TomcatMule management console installation with Tomcat
Mule management console installation with TomcatSudha Ch
 
Mule esb - How to connect to a MySql Database in 5 minutes
Mule esb - How to connect to a MySql Database in 5 minutesMule esb - How to connect to a MySql Database in 5 minutes
Mule esb - How to connect to a MySql Database in 5 minutesGennaro Spagnoli
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mulemdfkhan625
 

What's hot (20)

Deploying and running mule standalone
Deploying and running mule standaloneDeploying and running mule standalone
Deploying and running mule standalone
 
Getting started with Selenium 2
Getting started with Selenium 2Getting started with Selenium 2
Getting started with Selenium 2
 
Testing Agile Web Services from soapUI
Testing Agile Web Services from soapUITesting Agile Web Services from soapUI
Testing Agile Web Services from soapUI
 
Mule with velocity
Mule with velocityMule with velocity
Mule with velocity
 
Api webservice setupinstructions
Api webservice setupinstructionsApi webservice setupinstructions
Api webservice setupinstructions
 
JavaScript Testing VIA Selenium
JavaScript Testing VIA SeleniumJavaScript Testing VIA Selenium
JavaScript Testing VIA Selenium
 
Idempotent filter in Mule
Idempotent filter in MuleIdempotent filter in Mule
Idempotent filter in Mule
 
Spring Boot Showcase
Spring Boot ShowcaseSpring Boot Showcase
Spring Boot Showcase
 
Maven tools & archetypes
Maven tools & archetypesMaven tools & archetypes
Maven tools & archetypes
 
Mule ESB - How to convert from Xml to Json in 5 minutes
Mule ESB - How to convert from Xml to Json in 5 minutesMule ESB - How to convert from Xml to Json in 5 minutes
Mule ESB - How to convert from Xml to Json in 5 minutes
 
Example mule
Example muleExample mule
Example mule
 
Deploying and running in mule standalone
Deploying and running in mule standaloneDeploying and running in mule standalone
Deploying and running in mule standalone
 
Integration with Dropbox using Mule ESB
Integration with Dropbox using Mule ESBIntegration with Dropbox using Mule ESB
Integration with Dropbox using Mule ESB
 
Mule with drools
Mule with droolsMule with drools
Mule with drools
 
Sails.js Intro
Sails.js IntroSails.js Intro
Sails.js Intro
 
The WordPress developer's toolkit
The WordPress developer's toolkit The WordPress developer's toolkit
The WordPress developer's toolkit
 
Mule management console installation with Tomcat
Mule management console installation with TomcatMule management console installation with Tomcat
Mule management console installation with Tomcat
 
Mule esb - How to connect to a MySql Database in 5 minutes
Mule esb - How to connect to a MySql Database in 5 minutesMule esb - How to connect to a MySql Database in 5 minutes
Mule esb - How to connect to a MySql Database in 5 minutes
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mule
 
Mule velocity
Mule velocityMule velocity
Mule velocity
 

Similar to Java EE 02-First Servlet

Html servlet example
Html   servlet exampleHtml   servlet example
Html servlet examplervpprash
 
Jboss App Server
Jboss App ServerJboss App Server
Jboss App Serveracosdt
 
Servlet and jsp development with eclipse wtp
Servlet and jsp development with eclipse wtpServlet and jsp development with eclipse wtp
Servlet and jsp development with eclipse wtpodilodif
 
Writing simple web services in java using eclipse editor
Writing simple web services in java using eclipse editorWriting simple web services in java using eclipse editor
Writing simple web services in java using eclipse editorSantosh Kumar Kar
 
1 app 2 developers 3 servers
1 app 2 developers 3 servers1 app 2 developers 3 servers
1 app 2 developers 3 serversMark Myers
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applicationshchen1
 
Geoserver GIS Mapping Solution
Geoserver GIS Mapping SolutionGeoserver GIS Mapping Solution
Geoserver GIS Mapping SolutionKeshavSharma274
 
Jsp and Servlets
Jsp and ServletsJsp and Servlets
Jsp and ServletsRaghu nath
 
Weblogic 12c Graphical Mode installation steps in Windows
Weblogic 12c Graphical Mode installation steps in Windows Weblogic 12c Graphical Mode installation steps in Windows
Weblogic 12c Graphical Mode installation steps in Windows webservicesm
 
12c weblogic installation steps for Windows
12c weblogic installation steps for Windows12c weblogic installation steps for Windows
12c weblogic installation steps for WindowsCognizant
 
Jsp and servlet_netbeans-webapps
Jsp and servlet_netbeans-webappsJsp and servlet_netbeans-webapps
Jsp and servlet_netbeans-webappsOPENLANE
 

Similar to Java EE 02-First Servlet (20)

Tomcat + other things
Tomcat + other thingsTomcat + other things
Tomcat + other things
 
Servlet Demo (2).pptx
Servlet Demo (2).pptxServlet Demo (2).pptx
Servlet Demo (2).pptx
 
Html servlet example
Html   servlet exampleHtml   servlet example
Html servlet example
 
Jboss App Server
Jboss App ServerJboss App Server
Jboss App Server
 
Servlet and jsp development with eclipse wtp
Servlet and jsp development with eclipse wtpServlet and jsp development with eclipse wtp
Servlet and jsp development with eclipse wtp
 
Writing simple web services in java using eclipse editor
Writing simple web services in java using eclipse editorWriting simple web services in java using eclipse editor
Writing simple web services in java using eclipse editor
 
Jsf tutorial
Jsf tutorialJsf tutorial
Jsf tutorial
 
Jsp chapter 1
Jsp chapter 1Jsp chapter 1
Jsp chapter 1
 
Jsp and jstl
Jsp and jstlJsp and jstl
Jsp and jstl
 
Cis 274 intro
Cis 274   introCis 274   intro
Cis 274 intro
 
1 app 2 developers 3 servers
1 app 2 developers 3 servers1 app 2 developers 3 servers
1 app 2 developers 3 servers
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
 
Geoserver GIS Mapping Solution
Geoserver GIS Mapping SolutionGeoserver GIS Mapping Solution
Geoserver GIS Mapping Solution
 
Jdbc
JdbcJdbc
Jdbc
 
Java Servlets & JSP
Java Servlets & JSPJava Servlets & JSP
Java Servlets & JSP
 
Jsp and Servlets
Jsp and ServletsJsp and Servlets
Jsp and Servlets
 
Weblogic 12c Graphical Mode installation steps in Windows
Weblogic 12c Graphical Mode installation steps in Windows Weblogic 12c Graphical Mode installation steps in Windows
Weblogic 12c Graphical Mode installation steps in Windows
 
12c weblogic installation steps for Windows
12c weblogic installation steps for Windows12c weblogic installation steps for Windows
12c weblogic installation steps for Windows
 
Jboss Tutorial Basics
Jboss Tutorial BasicsJboss Tutorial Basics
Jboss Tutorial Basics
 
Jsp and servlet_netbeans-webapps
Jsp and servlet_netbeans-webappsJsp and servlet_netbeans-webapps
Jsp and servlet_netbeans-webapps
 

Recently uploaded

Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chipsGeoBlogs
 
NLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptxNLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptxssuserbdd3e8
 
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptxMatatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptxJenilouCasareno
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptxJosvitaDsouza2
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasGeoBlogs
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPCeline George
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxJisc
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismDeeptiGupta154
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfkaushalkr1407
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfTamralipta Mahavidyalaya
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfQucHHunhnh
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resourcesdimpy50
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasiemaillard
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxEduSkills OECD
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
 
Accounting and finance exit exam 2016 E.C.pdf
Accounting and finance exit exam 2016 E.C.pdfAccounting and finance exit exam 2016 E.C.pdf
Accounting and finance exit exam 2016 E.C.pdfYibeltalNibretu
 

Recently uploaded (20)

Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
NLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptxNLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptx
 
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptxMatatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
NCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdfNCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdf
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resources
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Accounting and finance exit exam 2016 E.C.pdf
Accounting and finance exit exam 2016 E.C.pdfAccounting and finance exit exam 2016 E.C.pdf
Accounting and finance exit exam 2016 E.C.pdf
 

Java EE 02-First Servlet

  • 1. Introduction to Java Enterprise Edition  Configuring JBoss within Eclipse  Write your first Servlet Fernando Gil lobho.gil@gmail.com Marzo 2012
  • 2. Agenda  How to configure JBoss AS within Eclipse in order to start the develop of JavaEE applications.  We'll write our first Servlet class.  We'll discuss the deployment descriptor.
  • 3. JBoss AS 6.1 & Eclipse Indigo  First download Eclipse IDE for Java Developers from: http://www.eclipse.org/downloads and JBoss 6.1 from: http://www.jboss.org/jbossas/downloads/  Open Eclipse.  Create a New Server: Go to File/New/Other  Select Server Option  Search JBoss 6.x  Browse JBoss Home  Directory (the folder where you saved JBoss) Click Finish 
  • 4. Important  If you can not find JBoss 6.x in the servers list, try to Download additional server adapters:  Sometimes eclipse can not find the JBoss adapters, in that case check this video tutorial to solve the problem: Eclipse & JBoss AS 6
  • 5. Dynamic Web Project  Open Eclipse and select File/New/ Dynamic Web Project  Set the Project Name and the location  In Target Runtime we must select the runtime of JBoss 6.x  The Dynamic web module version will be set automatically  We can Click Finish
  • 6. Creating our Servlet  In order to keep the example simple, we'll create a servlet selecting File/New/Class and set the values like in the picture:
  • 7. The Code package com.dss.tut; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class FirstServlet extends HttpServlet { /* The service() method handles requests and creates responses. * The servlet container automatically calls this method when * it gets any request for this servlet.*/ public void service(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException{ PrintWriter pw = resp.getWriter(); pw.println("<html>"); pw.println(" <head></head>"); pw.println(" <body>"); pw.println(" <h1>Hello! this is my first Servlet</h1>"); pw.println(" </body>"); pw.println("</html>"); } }
  • 8. Deployment Descriptor  We must indicate to the Application Server the configurations of our Servlets. The Deployment descriptor is a XML file to accomplish this task. We will talk more about this file later. By the moment we need to create a new file called web.xml in the directory: WebContent/WEB-INF of our project. <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> <servlet> <!-- Define our servlet indicating one name to identify it and the class which represent it including the package --> <servlet-name>First</servlet-name> <servlet-class>com.dss.tut.FirstServlet</servlet-class> </servlet> <servlet-mapping> <!-- Link one existent servlet with an url. Whit this we can specify the way we can access the Servlet by the browser--> <servlet-name>First</servlet-name> <url-pattern>/MyServlet</url-pattern> </servlet-mapping> </web-app>
  • 9. Compilation and Deployment  Now we just need to select our project, right click, Run As.., Run on Server, Select our JBoss Server and wait.  Remember the url pattern that we specified in the deployment descriptor, because that is the way we'll access to the Servlet.
  • 10. Next Lesson: JPS Technology Fernando Gil lobho.gil@gmail.com Marzo 2012