Order of servlet mapping in web.xml

Hello,
is the order of multiple <servlet-mapping> in web.xml important? Or it doesn't matter in which order they are declared?
For example, if i have two controllers, one is
<servlet-name>Faces Servlet</servlet-name>
  <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
  <load-on-startup>1</load-on-startup>
</servlet>
and the second:
  <servlet>
    <servlet-name>FrontController</servlet-name>
    <servlet-class>servlets.FrontController</servlet-class>
  </servlet>
and the mapping are:
   <servlet-mapping>
    <servlet-name>FrontController</servlet-name>
    <url-pattern>/jsf/*</url-pattern>
  </servlet-mapping>
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
  </servlet-mapping>where /jsf/ contains jsp pages containing jsf components.
is the order important?
And may second question is:
if i call the jsp page test.jsf in /jsf/test.jsp , which controller is responseble? Faces servlet or Frontcontroller?

Here is what the 2.4 specification says on the matter (section SRV.11.1):
>
The path used for mapping to a servlet is the request URL from the request
object minus the context path and the path parameters. The URL path mapping rules below are used in order. The first successful match is used with no further matches attempted:
1. The container will try to find an exact match of the path of the request to the
path of the servlet. A successful match selects the servlet.
2. The container will recursively try to match the longest path-prefix. This is done by stepping down the path tree a directory at a time, using the �/� character as a path separator. The longest match determines the servlet selected.
3. If the last segment in the URL path contains an extension (e.g. .jsp), the servlet container will try to match a servlet that handles requests for the extension. An extension is defined as the part of the last segment after the last �.� character.
4. If neither of the previous three rules result in a servlet match, the container will attempt to serve content appropriate for the resource requested. If a "default" servlet is defined for the application, it will be used.
The container must use case-sensitive string comparisons for matching.
It also notes that in prior versions of the specification these were only a suggestion so if you are on servlet 2.3 or prior, you need to consult the documentation for your container.
So, to answer your questions, no, order in the descriptor is not important.
Also, based on the rules above, using your mappings, any URL starting with /jsf will be handled by FrontController including /jsf/test.jsp and /jsf/test.jsf.

Similar Messages

  • JSP Servlet Mapping  in web.xml

    Hi!
    I have a JSP page by name "ContactUs.jsp" located in the folder <root>/jsp/info and I am using Tomcat Server. As I want to access this file using the URL "http://localhost:8080/<webapp>/ContactUs.jsp" instead of "http://localhost:8080/<webapp>/jsp/info/ContactUs.jsp". For this I added the follwing lines to web.xml file of my web app.
    <servlet>
    <servlet-name>org.apache.jsp.jsp.info.ContactUs_jsp</servlet-name>
    <servlet-class>org.apache.jsp.jsp.info.ContactUs_jsp</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>org.apache.jsp.jsp.info.ContactUs_jsp</servlet-name>
    <url-pattern>/ContactUs.jsp</url-pattern>
    </servlet-mapping>
    But I am getting the error saying that
    "ClassNotFoundException: org.apache.jsp.jsp.info.ContactUs_jsp"
    Is there any thing else to be modified? Please help me.
    Thanks in advance
    Geethanadh.K

    I'm no expert on this but I have a hunch. 1st of all, your using a servlet mapping for a JSP. That's good and well but it seems that the container is complaining that there is no servlet named org.apache.jsp.jsp.info.ContactUs_jsp. In other words it looks like the JSP has not been compiled. At least not yet. Maybe try two things. Visit the JSP once with a browser at it's actual path "http://localhost:8080/<webapp>/jsp/info/ContactUs.jsp" the coerce a page compile. Then try it with your new mapped path. You see, just telling the container that there is a servlet mapped to the new URL doesn't force the container to generate the class. Something or someone must generate the servlet class file.
    Honestly, I'm not sure of what your end goal is but maybe you might consider using a JSP pre-compiler? Or even better, register a servlet at the mapped path that fowards all requests into the desired folder.
    Cliff

  • Mime mapping in web.xml not working for csv/excel

    I am using the weblogic 8.1 app server. I want to serve up some static content
    from an "exploded" web application (dir structure instead of a war file). This
    static content includes html files and csv files that cause the browser to give
    an option to the user to open the file in excel or download to disk. I have inserted
    the following mapping inside web.xml in the exploded directory structure...
    <web-app>
    <mime-mapping>
    <extension>csv</extension>
    <mime-type>application/vnd.ms-excel</mime-type>
    </mime-mapping>
    </web-app>
    I redeployed the "web application". When I try to access a csv file, instead of
    giving me the save/open dialog, the browser displays the ASCII contents of the
    csv in the browser like an HTML file. Am I missing a step? Is the xml above not
    for the functionality that I am trying to implement here?
    Thanks.

    Hi All:
    Thanks for all your help regarding the adfAuthentication success_url. Now I am able to configure to make this work. But now I am facing another issue i.e. I am getting 401 Not authorized message when the success_url is pointed to the jspx page.
    Note: I am using custom login module similar to DBProcOraDataSourceLoginModule so my roles are stored in the custom Role class. So I am not sure how to pass this role info to the security in ADF in order to authorize the page to be viewed.
    Could you please help and can you point me to any specific link.
    Thanks & Regards
    Sridhar Doki

  • Do I must put ALL my servlets inside the web.xml file?

    Hello everybody,
    I am trying to migrate from Webshere to TOMCAT a project with severals packets, one of those have 15 servlets and some classes.
    Is there any way to use the servlets without have to declare each one inside the web.xlm file ?
    Thanks in advance.

    All servlet definitions go into web.xml, though not the actual servlets themselves :) . Say if you wanted servlet A to have a different mapping you would define the mapping in web.xml to something other than the standard one.

  • Is there any alternative for adding servlet name in Web.xml?

    Hi,
    I am new to Weblogic and I have an application(Ear file) which was developed
    in Websphere and I am trying to install in weblogic 8.1. I have installed my application
    in Websphere without adding servlet entries in Web.xml and it was working fine.
    I have installed the same Ear file in Tomcat and added the
    following to make all my all servlets work.
    <servlet-mapping>
    <servlet-name>invoker</servlet-name>
    <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>
    Is there any alternative of doing like that in WebLogic instead of adding each
    and every servlet entry in web.xml because my application has around 200 servlets
    Thanks&Regards,
    Gopi.

    Is Servlet servlet same as weblogic.servlet.ServletServlet?
    Deepak
    Rob Woollen <[email protected]> wrote:
    Yes, you could register weblogic.servlet.ServletServlet.
    -- Rob
    Gopi Krishna wrote:
    Hi,
    I am new to Weblogic and I have an application(Ear file) whichwas developed
    in Websphere and I am trying to install in weblogic 8.1. I have installedmy application
    in Websphere without adding servlet entries in Web.xml and it was workingfine.
    I have installed the same Ear file in Tomcat and added the
    following to make all my all servlets work.
    <servlet-mapping>
    <servlet-name>invoker</servlet-name>
    <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>
    Is there any alternative of doing like that in WebLogic instead ofadding each
    and every servlet entry in web.xml because my application has around200 servlets
    Thanks&Regards,
    Gopi.

  • Regular Expression Filter Mapping In Web.xml

    I have a situation where I need to filter URL's that don't have a file extension. There are hundreds of URL's, so i can't specify each one separately.
    From what I understand, you can have a filter mapping in web.xml to map certain file extensions to a filter, such as :
    <filter>
    <filter-name>MyFilter</filter-name>
    <filter-class>com.filters.MyFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>MyFilter</filter-name>
    <url-pattern>*.esi</url-pattern>
    </filter-mapping>
    ...where all files of extension .esi go through the filter. Additionally, I want to map all url's WITHOUT a file extension to pass through this filter. So if I have a request for "http://myserver.com/home" it will pass through the filter.
    Does weblogic support regular expressions for pattern matching in filter-mapping? If so, can you provide examples or links to documentation?
    Thanks,
    Jim

    No, regular expressions are not supported. You can specify the mapping with extensions, or with paths, not at the same time in the same mapping specification. However, you can specify two servlet mappings, one with extension, and one with path.
    The exact wording from the spec (2.4) is as follows:
    In the Web application deployment descriptor, the following syntax is used to define
    mappings:
    • A string beginning with a ‘/’ character and ending with a ‘/*’ suffix is used
    for path mapping.
    • A string beginning with a ‘*.’ prefix is used as an extension mapping.
    • A string containing only the ’/’ character indicates the "default" servlet of
    the application. In this case the servlet path is the request URI minus the context
    path and the path info is null.
    • All other strings are used for exact matches only.

  • Servlet mappings in web.xml is not picking up propelry

    Hi,
    I am developing on java web application in Jdeveloper and trying to deploy in integrated wls.
    i have one jsp page, and one java servlet. and added url-pattern and servlet mappings in web.xml, but when running the jsp, it is not picking up the servelt . I am getting the error saying 'The server has not found anything matching the Request-URI.'
    Can you help me in fixing this issue.
    Thanks in advance.

    Hi,
    I have one Test.html file under public_html folder, and in that html form action url is as below:
    <form action="/servlet/testServlet" method="post">
    .</form>
    and my web.xml content is:
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
    <servlet>
    <display-name>TestServlet</display-name>
    <servlet-name>TestServlet</servlet-name>
    <servlet-class>oracle.apps.servlet.TestServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>TestServlet</servlet-name>
    <url-pattern>/servlet/testServlet</url-pattern>
    </servlet-mapping>
    </web-app>
    When i run the HTML page, the URL is : http://local:7101/Application1-Test-context-root/Test.html
    and when click on button, its redirecting to http://local:7101/servlet/testServlet and getting the error saying that 'The server has not found anything matching the Request-URI' ideally it shuld redirect to http://local:7101/Application1-Test-context-root/servlet/testServlet.
    let me know what could be the problem?

  • How to run java servlet without using Web.xml?

    How to run servlet without using Web.xml? From a book, I know that web.xml descriptor is optional, but the book doesn't tell us how to run java servelet without web.xm descriptor. So how to do that? Thanks a lot.

    How to run servlet without using Web.xml?But Tomcat now uses a web.xml for its global server-wide configuration.
    If you'd like to invoke a servlet with:
    http://host/servlet/ServletName
    you have to enable the invoker servlet.
    [from an HTML]
      <FORM METHOD="POST" ACTION="/servlet/HGrepSearchSJ">
    [from resin.conf of Resin Web Server 2.1.12]
      <!--
         - The "invoker" servlet invokes servlet classes from the URL.
         - /examples/basic/servlet/HelloServlet will start the HelloServlet
         - class.  In general, the invoker should only be used
         - for development, not on a deployment server, because it might
         - leave open security holes.
        -->
      <servlet-mapping url-pattern='/servlet/*' servlet-name='invoker'/>
    [from TOMCAT5.0.19/conf/web.xml, a global server-wide web.xml file]
      <!-- The "invoker" servlet, which executes anonymous servlet classes      -->
      <!-- that have not been defined in a web.xml file.  Traditionally, this   -->
      <!-- servlet is mapped to URL pattern "/servlet/*", but you can map it    -->
      <!-- to other patterns as well.  The extra path info portion of such a    -->
      <!-- request must be the fully qualified class name of a Java class that  -->
      <!-- implements Servlet (or extends HttpServlet), or the servlet name     -->
      <!-- of an existing servlet definition.     This servlet supports the     -->
      <!-- following initialization parameters (default values are in square    -->
      <!-- brackets):                                                           -->
      <!--                                                                      -->
      <!--   debug               Debugging detail level for messages logged     -->
      <!--                       by this servlet.  [0]                          -->
        <servlet>
            <servlet-name>invoker</servlet-name>
            <servlet-class>
              org.apache.catalina.servlets.InvokerServlet
            </servlet-class>
            <init-param>
                <param-name>debug</param-name>
                <param-value>0</param-value>
            </init-param>
            <load-on-startup>2</load-on-startup>
        </servlet>
    ---comment out below----------------------------------------------------------
        <!-- The mapping for the invoker servlet -->
    <!--
        <servlet-mapping>
            <servlet-name>invoker</servlet-name>
            <url-pattern>/servlet/*</url-pattern>
        </servlet-mapping>
    -->

  • Servlet Filters not following filter mapping in web.xml

    Hi Experts,
    I have two Servlet filters SetCharacterEncodingFilter and LASBackOfficeAuthFilter which are mapped in such a way that SetCharacterEncodingFilter gets called before LASBackOfficeAuthFilter(This is done in web.xml using filter mapping).
    I have code in SetCharacterEncodingFilter init() method to read and store the few parameters from a table , it also creates a new thread to montior db changes in these paremeters . LASBackOfficeAuthFilter reads a those parameters set after SetCharacterEncodingFilter initialization. This is failing in Weblogic Version: 10.3.2.0 because the LASBackOfficeAuthFilter init method gets called before SetCharacterEncodingFilter init method.
    This is filter mapping order is working fine In Web Sphere and Tomcat 6 .
    The web.xml filter mapping is given below .
         <filter>
              <filter-name>LASBackOfficeAuthFilter</filter-name>
              <display-name>Scheduler Authentication Filter</display-name>
              <filter-class>com.scheduler.servlet.backoffice.LASBackOfficeAuthFilter</filter-class>
              <!-- parameters specifying BackOffice servlet path translation -->
              <init-param>
                   <param-name>PathLogin</param-name>
                   <param-value>/login</param-value>
              </init-param>
              <init-param>
                   <param-name>PathLogout</param-name>
                   <param-value>/logout</param-value>
              </init-param>
              <init-param>
                   <param-name>PathNotifications</param-name>
                   <param-value>/secure/notifications</param-value>
              </init-param>
              <init-param>
                   <param-name>PathSchedulerActions</param-name>
                   <param-value>/secure/schedactions</param-value>
              </init-param>
              <init-param>
                   <param-name>PathPing</param-name>
                   <param-value>/secure/ping</param-value>
              </init-param>
         </filter>
         <!--
              this filter sets character encoding and mimetype for requests and
              responses
         -->
         <filter>
              <filter-name>SetCharacterEncodingFilter</filter-name>
              <display-name>Scheduler Character Encoding Filter</display-name>
              <filter-class>com.scheduler.servlet.backoffice.SetCharacterEncodingFilter</filter-class>
         </filter>
         <!-- correlate servlets and filters -->
         <filter-mapping>
              <filter-name>SetCharacterEncodingFilter</filter-name>
              <servlet-name>LASBackOfficeServlet</servlet-name>
         </filter-mapping>
         <filter-mapping>
              <filter-name>LASBackOfficeAuthFilter</filter-name>
              <servlet-name>LASBackOfficeServlet</servlet-name>
         </filter-mapping>
    Any help on this would be very much appreciated .
    Regards
    Dinesh

    No, regular expressions are not supported. You can specify the mapping with extensions, or with paths, not at the same time in the same mapping specification. However, you can specify two servlet mappings, one with extension, and one with path.
    The exact wording from the spec (2.4) is as follows:
    In the Web application deployment descriptor, the following syntax is used to define
    mappings:
    • A string beginning with a ‘/’ character and ending with a ‘/*’ suffix is used
    for path mapping.
    • A string beginning with a ‘*.’ prefix is used as an extension mapping.
    • A string containing only the ’/’ character indicates the "default" servlet of
    the application. In this case the servlet path is the request URI minus the context
    path and the path info is null.
    • All other strings are used for exact matches only.

  • Can i run a servlet without a web.xml file for servlet mapping?

    Hello everyone.
    The code i want to run compiles and everythink looks ok.
    It produces the .class file.
    I run Tomcat 4.1 and i build my Web site with Dreamweaver.
    I have a form in a page and i want to send the data upon form completion to a database i already have build with MySql.
    The database is up and running and the server is set-up ok.
    I have changed the port in Tomcat to run on port 80.
    The directory i have my site is
    Tomcat41\webapps\ROOT\se
    and the directory where i keep the servlet class is
    Tomcat41\webapps\ROOT\se\WEB-INF\servlet
    I have a web.xml file to map the servlet and placed it in
    Tomcat41\webapps\ROOT\se\WEB-INF
    In the Form action i write action:"/servlets/Classes/GroupRegistration"
    and I RECEIVE AN 404 ERROR FROM APACHE.
    Somethink is wrong .
    The following is the code from the GroupRegistration.java file
    and follws the web.xml file.
    Please Help.
    import java.sql.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class GroupRegistration extends HttpServlet
    Connection con;
    public void doPost (HttpServletRequest req, HttpServletResponse res)
                             throws ServletException, java.io.IOException
         handleForm(req, res);
    public void init() throws ServletException {
         try{
         /* Loading the driver for the database */
         Class.forName("com.mysql.jdbc.Driver");
         Connection Con = DriverManager.getConnection("jdbc:mysql://localhost/se?user=luser&password=");
         catch (ClassNotFoundException e) {
         throw new UnavailableException("Couldn't load JdbcOdbcDriver");
         catch (SQLException e) {
         throw new UnavailableException("Couldn't get db connection");
         private void handleForm(HttpServletRequest req, HttpServletResponse res)
         throws ServletException {
         //ServletOutputStream out = res.OutputStream();
         //res.setContentType("text/html");
         //Extract the form Data Here
         String group = req.getParameter("GroupNo");
         String Name1 = req.getParameter("Name1");
         String LoginID1 = req.getParameter("LoginID1");
         String Name2 = req.getParameter("Name2");
         String LoginID2 = req.getParameter("LoginID2");
         String Name3 = req.getParameter("Name3");
         String LoginID3 = req.getParameter("LoginID3");
         String Name4 = req.getParameter("Name4");
         String LoginID4 = req.getParameter("LoginID4");
         String URL = req.getParameter("URL");
         String Title2 = req.getParameter("Title2");
         String date = req.getParameter("date");
         String INSERT = "INSERT INTO registration (groupno, name1, loginid1, name2, loginid2, name3, loginid3, name4, loginid4, url, topic, date) VALUES (" + group + "," + Name1 + "," + LoginID2 + "," + Name2 + "," + LoginID2 + "," + Name3 + "," + LoginID3 + "," + Name4 + "," + LoginID4 + "," + URL + "," + Title2 + "," + date + ")";
         PreparedStatement pstmt = null;
         try{
         pstmt = con.prepareStatement(INSERT);
         pstmt.executeUpdate();
         catch (SQLException e) {
         throw new ServletException(e);
         finally {
         try {
         if (pstmt != null)pstmt.close();
         catch (SQLException ignored){
    The web.xml file
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com.xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
    <servlet>
    <servlet-name>GroupRegistration</servlet-name>
    <servlet-class>GroupRegistration</servlet-class>
    </servlet>
    <servlet-maping>
    <servlet-name>GroupRegistration</servlet-name>
    <url-pattern>/myGroupRegistration</url-patern>
    </servlet-mapping>
    </web-app>
    I apreciate your time.
    Thanks for any help.

    and the directory where i keep the servlet class is
    Tomcat41\webapps\ROOT\se\WEB-INF\servletOthers have pointed out that "servlet" should be "classes", but there is another mistake that hasn't been spotted. If you want your servlet to appear in the root context, you should use:
    Tomcat41\webapps\ROOT\WEB-INF\classes
    If you want your servlet to appear under the /se context, then you should use:
    Tomcat41\webapps\se\WEB-INF\classes
    and also, in the latter case, your form action should be /se/myGroupRegistration.

  • Weblogic.servlet.reloadCheckSecs in web.xml not working

    Given the following web.xml file:
              <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
              1.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
              <web-app>
              <context-param>
              <param-name>weblogic.servlet.reloadCheckSecs</param-name>
              <param-value>100</param-value>
              </context-param>
              <servlet>
              <servlet-name>CookieCounter</servlet-name>
              <servlet-class>servlets.CookieCounter</servlet-class>
              </servlet>
              <servlet-mapping>
              <servlet-name>CookieCounter</servlet-name>
              <url-pattern>monster</url-pattern>
              </servlet-mapping>
              <welcome-file-list>
              <welcome-file>hello.html</welcome-file>
              </welcome-file-list>
              <error-page>
              <error-code>404</error-code>
              <location>/error.jsp</location>
              </error-page>
              </web-app>
              It seems the weblogic.servlet.reloadCheckSecs property is not taking effect.
              The
              default value of -1 is always used. I did stop and restart weblogic.
              I also trid to set the servlet classpath in the web.xml file with
              weblogic.servlet.classpath
              property and it did not change the classpath for the servlet. It seems that
              other
              items are working such as adding new servletrs to the web application. Note
              that
              this is the cookie sample application that installes with the beta 2
              download.
              Thanks,
              Dan.
              

    Hi All:
    Thanks for all your help regarding the adfAuthentication success_url. Now I am able to configure to make this work. But now I am facing another issue i.e. I am getting 401 Not authorized message when the success_url is pointed to the jspx page.
    Note: I am using custom login module similar to DBProcOraDataSourceLoginModule so my roles are stored in the custom Role class. So I am not sure how to pass this role info to the security in ADF in order to authorize the page to be viewed.
    Could you please help and can you point me to any specific link.
    Thanks & Regards
    Sridhar Doki

  • Servlet registration in web.xml with weblogic 5.1 sp10

    I've been developing this site using one "dispatch"
              servlet as my traffic cop for my framework. i now
              have to do this charting thing and i plan to
              stream in an image from a servlet. this means adding
              another servlet to the application. i've edited the
              web.xml according to the standerd and WL still pukes
              on startup saying
              "Error parsing descriptor in Web application
              'c:/workspace/com/somthing/'
              org.xml.sax.SAXParseException: Element "web-app" does
              not allow "servlet" here."
              below is my web.xml file...
              <?xml version="1.0" encoding="ISO-8859-1"?>
              <!DOCTYPE web-app
              PUBLIC "-//Sun Microsystems, Inc.//DTD Web
              Application 2.2//EN"
              "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
              <web-app>
              <description>
              blah blah
              </description>
              <servlet>
              <servlet-name>
              WebDispatcher
              </servlet-name>
              <servlet-class>
              com.somthing.somthin.WebDispatcher
              </servlet-class>
              </servlet>
              <servlet-mapping>
              <servlet-name>
              WebDispatcher
              </servlet-name>
              <url-pattern>
              /dispatch
              </url-pattern>
              </servlet-mapping>
              <servlet>
              <servlet-name>
              AssetChartServlet
              </servlet-name>
              <servlet-class>
              com.something.somthn.charts.ChartServlet
              </servlet-class>
              </servlet>
              <servlet-mapping>
              <servlet-name>
              ChartServlet
              </servlet-name>
              <url-pattern>
              /Chart
              </url-pattern>
              </servlet-mapping>
              some jsp tags
              </web-app>
              What am I doing wrong? Do I have to register the
              servlet in the weblogic.properties file? If so do I add the line
              weblogic.httpd.register.chart=com.somthing.somthin.charts.ChartServlet
              And the the (local)url would be http://localhost:7001/Chart ? And if
              this is the case where/how do I do the url mapping bit for this?
              Any help would be greatly appreciated.
              thanks,
              -Gabe
              

    To answer Mike's follow-up question, yes. From the DTD for the web.xml
              file:
              <!ELEMENT web-app (icon?, display-name?, description?, distributable?,
              context-param*, servlet*, servlet-mapping*, session-config?,
              mime-mapping*, welcome-file-list?, error-page*, taglib*,
              resource-ref*, security-constraint*, login-config?, security-role*,
              env-entry*, ejb-ref*)>
              The ordering of elements must be followed if they are specified in the DTD.
              Move your first <servlet-mapping> element to after the second <servlet>
              element and it should work just fine.
              -chris
              "Mike Reiche" <[email protected]> wrote in message
              news:[email protected]...
              >
              >
              >
              > Hmmm... do all the <servlet> </servlet> need to come before all the
              <servlet-mapping>
              > ?
              >
              > Mike
              >
              >
              > [email protected] (gabe) wrote:
              > >I've been developing this site using one "dispatch"
              > >servlet as my traffic cop for my framework. i now
              > >have to do this charting thing and i plan to
              > >stream in an image from a servlet. this means adding
              > >another servlet to the application. i've edited the
              > >web.xml according to the standerd and WL still pukes
              > >on startup saying
              > >
              > >"Error parsing descriptor in Web application
              > >'c:/workspace/com/somthing/'
              > >org.xml.sax.SAXParseException: Element "web-app" does
              > >not allow "servlet" here."
              > >
              > >below is my web.xml file...
              > >------------------------------
              > >
              > ><?xml version="1.0" encoding="ISO-8859-1"?>
              > >
              > ><!DOCTYPE web-app
              > > PUBLIC "-//Sun Microsystems, Inc.//DTD Web
              > >Application 2.2//EN"
              > > "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
              > >
              > ><web-app>
              > >
              > > <description>
              > > blah blah
              > > </description>
              > >
              > > <servlet>
              > > <servlet-name>
              > > WebDispatcher
              > > </servlet-name>
              > > <servlet-class>
              > > com.somthing.somthin.WebDispatcher
              > > </servlet-class>
              > > </servlet>
              > > <servlet-mapping>
              > > <servlet-name>
              > > WebDispatcher
              > > </servlet-name>
              > > <url-pattern>
              > > /dispatch
              > > </url-pattern>
              > > </servlet-mapping>
              > >
              > > <servlet>
              > > <servlet-name>
              > > AssetChartServlet
              > > </servlet-name>
              > > <servlet-class>
              > > com.something.somthn.charts.ChartServlet
              > > </servlet-class>
              > > </servlet>
              > > <servlet-mapping>
              > > <servlet-name>
              > > ChartServlet
              > > </servlet-name>
              > > <url-pattern>
              > > /Chart
              > > </url-pattern>
              > > </servlet-mapping>
              > >
              > > ...
              > > some jsp tags
              > > ...
              > >
              > ></web-app>
              > >---------------------------------
              > >What am I doing wrong? Do I have to register the
              > >servlet in the weblogic.properties file? If so do I add the line
              > >
              > >weblogic.httpd.register.chart=com.somthing.somthin.charts.ChartServlet
              > >
              > >And the the (local)url would be http://localhost:7001/Chart ? And if
              > >this is the case where/how do I do the url mapping bit for this?
              > >
              > >Any help would be greatly appreciated.
              > >
              > >thanks,
              > >
              > >-Gabe
              >
              

  • Sevlet without specific mapping in web.xml

    Hi,
              1. How to invoke a servlet without specfic mapping entry in the web.xml file, by compiling and placing the class file under WEB-INF/classes directory?
              2. Is it correct to mapping the servlets in the directory structure alone (not specific), Like
              <servlet-mapping>
              <servlet-name>/myservlets/*</servlet-name>
              <url-pattern>servlets/../myservlets/*</url-pattern>
              Where * - for servlets under myservlets package compiled and placed under WEB-INF classes and invoked from the browser as
              http://localhost:9999/servlets/../myservlets/testpackage.test
              

    You can use servletservlet :
              web.xml:
              <web-app>
              <servlet>
              <servlet-name>ServletServlet</servlet-name>
              <servlet-class>weblogic.servlet.ServletServlet</servlet-class>
              </servlet>
              <servlet-mapping>
              <servlet-name>ServletServlet</servlet-name>
              <url-pattern>/servlets/*</url-pattern>
              </servlet-mapping>
              </web-app>
              and your servlet will be accessible as
              http://localhost:7001/yourWebApp/servlets/testpackage/test
              Chitrapandian <[email protected]> wrote:
              > Hi,
              > 1. How to invoke a servlet without specfic mapping entry in the web.xml file, by compiling and placing the class file under WEB-INF/classes directory?
              > 2. Is it correct to mapping the servlets in the directory structure alone (not specific), Like
              > <servlet-mapping>
              > <servlet-name>/myservlets/*</servlet-name>
              > <url-pattern>servlets/../myservlets/*</url-pattern>
              >
              > Where * - for servlets under myservlets package compiled and placed under WEB-INF classes and invoked from the browser as
              > http://localhost:9999/servlets/../myservlets/testpackage.test
              Dimitri
              

  • Servlet 2.4 web.xml error - Cant load the Schema

    i have coded the web.xml for my application as below,
    i am using Servlet 2.4 and Tomcat 5.5
    when i viewed the same in XML editor, it gave the following error -
    "Can't Load the W3C XML Schema" , cant figure what is the reason for this error. Any help would be greatly appreciated
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app
    xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">
         <display-name>Rdp</display-name>
         <servlet>
              <servlet-name>action</servlet-name>
              <servlet-class>com.rdp.util.RDServlet</servlet-class>
              <init-param>
                   <param-name>config</param-name>
                   <param-value>/WEB-INF/config/struts-config.xml</param-value>
              </init-param>
              <init-param>
                   <param-name>debug</param-name>
                   <param-value>2</param-value>
              </init-param>
              <init-param>
                   <param-name>detail</param-name>
                   <param-value>2</param-value>
              </init-param>
              <init-param>
                   <param-name>validate</param-name>
                   <param-value>true</param-value>
              </init-param>
              <init-param>
                   <param-name>programe-name</param-name>
                   <param-value>Rdp</param-value>
              </init-param>
              <init-param>
                   <param-name>application</param-name>
                   <param-value>ApplicationResources</param-value>
              </init-param>                              
              <load-on-startup>2</load-on-startup>
         </servlet>
         <servlet-mapping>
              <servlet-name>action</servlet-name>
              <url-pattern>*.do</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>
         <taglib>
              <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
              <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
         </taglib>
         <taglib>
              <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
              <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
         </taglib>
         <taglib>
              <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
              <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
         </taglib>
    </web-app>

    i have coded the web.xml for my application as below,
    i am using Servlet 2.4 and Tomcat 5.5
    when i viewed the same in XML editor, it gave the
    following error -
    "Can't Load the W3C XML Schema" , cant figure what is
    the reason for this error. Any help would be greatly
    appreciated
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app
    xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">
    <display-name>Rdp</display-name>
         <servlet>
              <servlet-name>action</servlet-name>
              <servlet-class>com.rdp.util.RDServlet</servlet-class
    >
              <init-param>
                   <param-name>config</param-name>
                   <param-value>/WEB-INF/config/struts-config.xml</par
    am-value>
              </init-param>
              <init-param>
                   <param-name>debug</param-name>
                   <param-value>2</param-value>
              </init-param>
              <init-param>
                   <param-name>detail</param-name>
                   <param-value>2</param-value>
              </init-param>
              <init-param>
                   <param-name>validate</param-name>
                   <param-value>true</param-value>
              </init-param>
              <init-param>
                   <param-name>programe-name</param-name>
                   <param-value>Rdp</param-value>
              </init-param>
              <init-param>
                   <param-name>application</param-name>
                   <param-value>ApplicationResources</param-value>
              </init-param>                              
              <load-on-startup>2</load-on-startup>
         </servlet>
         <servlet-mapping>
              <servlet-name>action</servlet-name>
              <url-pattern>*.do</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>
         <taglib>
              <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
              <taglib-location>/WEB-INF/struts-bean.tld</taglib-lo
    cation>
         </taglib>
         <taglib>
              <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
              <taglib-location>/WEB-INF/struts-html.tld</taglib-lo
    cation>
         </taglib>
         <taglib>
              <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
              <taglib-location>/WEB-INF/struts-logic.tld</taglib-l
    ocation>
         </taglib>
    </web-app>
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd"
    version="2.4">
    It looks the schema specified in your application is slightly different or wrong.
    Please correct it !!

  • Do Weblogic 5.1 support servlet 2,2 web.xml?

    Found that a lot of tags in web.xml according to Java servlet 2.2 API didn't work in Weblogic server 5.1, tags such as <session-mapping>, <session-timeout> didn't work at all. Is these tags didn't support in 5.1?
              

              Thank for your correction on the <servlet-mapping>, it is a typing error, it works
              after I correct it.
              But the <session-timout> tag still didn't work.
              I set it up as follow in my web.xml:
              <session-config>
              <session-timeout>30</session-timeout>
              </session-config>
              My testing servlet code as follows, it always shows a timeout value of 1800 seconds
              instead of my preset 30 seconds in the web.xml:
              public void doGet(HttpServletRequest request, HttpServletResponse response) throws
              ServletException, IOException {
                   HttpSession session = request.getSession();
                   response.setContentType("text/html");
                   OutputStreamWriter osw = new OutputStreamWriter(response.getOutputStream());
                   PrintWriter out = new PrintWriter (response.getOutputStream());
                   out.println("<html>");
                   out.println("<head><title>HelloWorld</title></head>");
                   out.println("<body>Hello From HelloWorld doGet()");
                   out.println("<P>Session will be timeout for " + session.getMaxInactiveInterval()
              + " secs.");
                   out.println("</body></html>");
                   out.close();
              Kumar Allamraju <[email protected]> wrote:
              ><!doctype html public "-//w3c//dtd html 4.0 transitional//en">
              ><html>
              >Do you mean servlet mapping? I can't seem to find out session-mapping
              >in
              >the dtd
              ><br>Yes we do support session-timeout in 5.1
              ><br>see http://www.weblogic.com/docs51/classdocs/webappguide.html
              ><p>--
              ><br>Kumar
              ><p>Alfred Leung wrote:
              ><blockquote TYPE=CITE>Found that a lot of tags in web.xml according to
              >Java servlet 2.2 API didn't work in Weblogic server 5.1, tags such as
              ><session-mapping>,
              ><session-timeout> didn't work at all. Is these tags didn't support
              >in
              >5.1?</blockquote>
              ></html>
              >
              

Maybe you are looking for

  • Transfering I tunes Library to external hard drive?

    Hi, The other day to free up space on my hard drive I transferred my Itunes Folder to an external hard drive. When I updated to 5.0 and went into preferences to point to the new location for the library I tunes does not recognize the library. I have

  • Data Execution Prevention preventing iTunes from working

    I have iTunes 8.0.2.20 running on Windows Server 2008 SP1. Whenever I plug in my iPod Nano, Data Execution Prevention (DEP) shuts down iTunes. I can't create an exception for iTunes in DEP since it gives the following error message: +"This program mu

  • Tracking inventory flow from gr to gi

    Scenario is like this :- A Purchase Order is made for a material code and is released completely (e.g. a po is raised for 100 nos.)  (T-code ME21N for Create and ME29N for Release).  The Purchase Order is made with Accounts Assignment Category as u20

  • Organizing folders

    I copied all of my pictures from my pc to cds and imported them to iphoto. i have a problem with which folders my pictures end up in. for instance, in my iphoto library one main folder is a year ,"2003", which leads to another folder, a number, "6",

  • How to access oracle which on virtualbox windows xp from Host

    I have oracle 10g installed on virutalbox XP and I want to access that database from the host Windows 7 system. I have oracle 11g client installed on host system. Thanks