Results 1 to 5 of 5

Thread: Servlet Mapping in Java

  1. #1
    Join Date
    Nov 2009
    Posts
    712

    Servlet Mapping in Java

    Hello, I want to know the details about the Servlet Mapping in java. I have search details about it, but, I am not able to know more about it. So, if you are having more details about it, then please provide that details to me. I will be thankful to you. If you are having details then reply me.

  2. #2
    Join Date
    May 2008
    Posts
    2,012

    Re: Servlet Mapping in Java

    Hey, I have tried to create a servlet mapping. You can use it in your program.
    Code:
    xml version ="1.0" encoding ="UTF-8"?>
    <web-app id ="WebApp_ID" version ="2.4" xmlns ="http://java.sun.com/xml/ns/j2ee" xmlns: xsi ="http://www.techarena.in/2010/XMLSchema-instance" xsi: schemaLocation ="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <display-name>
    asea </ display-name>
    <servlet>
    <description>
    </ description>
    <display-name>
    administerValidation </ display-name>
    <servlet-name> administerValidation </ servlet-name>
    <servlet-class>
    com.asea.administerValidation</ servlet-class>
    </ servlet>
    <servlet-mapping>
    <servlet-name> administerValidation </ servlet-name>
    <url-pattern> / administerValidation </ url-pattern>
    </ servlet-mapping>
    <welcome-file-list>
    <welcome-file> index.html</ welcome-file>
    <welcome-file> index.htm</ welcome-file>
    <welcome-file> index.jsp</ welcome-file>
    <welcome-file> default.html</ welcome-file>
    <welcome-file> default.htm</ welcome-file>
    <welcome-file> default.jsp</ welcome-file>
    </ welcome-file-list>

  3. #3
    Join Date
    May 2008
    Posts
    2,297

    Re: Servlet Mapping in Java

    If you want to know about the Servlet mapping then it is the technique which is used for the specification of the web container. It will be provided by the client and it will be invoked for a url from the client. Mapping is done for the url patterns to the servlets. Your servlet mapping is done with the following basic :
    Code:
    <servlet-mapping>
    <servlet-name>milk</servlet-name>
    <url-pattern>/drink/*</url-pattern>
    </servlet-mapping>

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Servlet Mapping in Java

    Servlet Mapping Techniques :
    As a servlet engine developer, you have a great deal of flexibility in how you map client requests to servlets. This specification does not mandate how the mapping should take place. However, you should feel free to use any of the following techniques:
    • You can map a servlet to just one URL.
    • You can map a servlet to any URL that begins with a certain directory name.
    • You can map a servlet to any URL that ends with a certain file name extension.
    • You can map a servlet by using the special URL /servlet/servlet_name.
    • You can invoke a servlet by its class name.

  5. #5
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Servlet Mapping in Java

    servlet-mapping: Servlet mapping is a techinque which will be used for mapping a URL to the servlet while executing. It is having a url-pattern for matching the URL. And also a servlet name for matching the configured servlet. Below is the typical servlet-mapping :

    Code:
    <servlet>
      <servlet-name>Check</servlet-name>
      <servlet-class>CheckIT</servlet-class>
    </servlet>
    
    <servlet-mapping>
      <url-pattern>/Check/*</url-pattern>
      <servlet-name>Check</servlet-name>
    </servlet-mapping>

Similar Threads

  1. JSP and Servlet problem
    By Devabrata in forum Software Development
    Replies: 5
    Last Post: 21-07-2010, 12:12 AM
  2. Manage Two Buttons In A Servlet
    By Jagdish Gada in forum Software Development
    Replies: 5
    Last Post: 05-03-2010, 02:43 PM
  3. Difference between Servlet & ASP
    By Owen Fernandes in forum Software Development
    Replies: 5
    Last Post: 05-02-2010, 10:53 AM
  4. What is Servlet container?
    By Sonam Goenka in forum Software Development
    Replies: 5
    Last Post: 05-02-2010, 08:13 AM
  5. What does preinitialization means in Java Servlet?
    By Karsenman in forum Software Development
    Replies: 5
    Last Post: 30-01-2010, 10:48 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,719,308,630.88184 seconds with 17 queries