Setting servlet mapping?

a newbie question:
My servlet are running fine when requested by:
http://myMachine.com:7777/j2ee/servlet/com.whatever.MyServlet
However I want it to be reached by:
http://myMachine.com:7777/servlet/com.whatever.MyServlet
note the missing "/j2ee". What is the proper way to set this mapping of the servlet directory?
I assume it might be done in the according web.xml?
Is it clever to edit web.xml manually? Do I have to use dcmctl udateconfig
afterwards?
Any hints are appreciated!

I see what you mean. WebContent is just a general name. I use maven for building, which uses webapp as a standard.
As far as having pages in a faces directory, that should be the case. I'm using /faces/* for the servlet mapping in my web.xml. Any requested url with that pattern should map the request to the faces servlet. Whatever page replaces the * would then be located in the root of the webapp directory by the faces servlet.
My app doesn't seem to be getting that far. The /faces request doesn't seem to be getting to the faces servlet, as there are no initialization lines being dumped to my log file, but when I use *.jsf, it does.

Similar Messages

  • 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.

  • Bug in servlet mapping

              Hi, it appears that the servlet mapping specified in section 10 of the
              Servlet 2.2 spec is broken in Weblogic server 6.0 GA. Here is the servlet
              2.2. spec for mapping:
              10.1 Use of URL Paths
              Servlet containers must use URL paths to map requests to servlets. The
              container uses the
              RequestURI from the request, minus the Context Path, as the path to map to a
              servlet. The URL
              path mapping rules are as follows (where the first match wins and no further
              rules are attempted):
              1. The servlet container will try to match the exact path of the request to
              a servlet.
              2. The container will then try to recursively match the longest path prefix
              mapping. This process
              occurs by stepping down the path tree a directory at a time, using the '/'
              character as a path
              separator, and determining if there is a match with a servlet.
              3. If the last node of the url-path contains an extension (.jsp for
              example), the servlet container
              will try to match a servlet that handles requests for the extension. An
              extension is defined as the
              part of the path after the last '.' character.
              4. If neither of the previous two 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 in this case.
              It appears that Weblogic does step #3 before step #2. This means that if
              you have a servlet called 'foo' mapped to '/foo/*' and Weblogic 6.0 receives
              a request for '/foo/bar.jsp', the container returns an error because it
              cannot find a JSP file called "bar.jsp" to compile, when according to the
              spec, servlet 'foo' should receive the request with the pathInfo value set
              to "/bar.jsp".
              The workaround is to assign all *.jsp files to the servlet 'foo' as well,
              but this breaks all other JSP files in the same web application.
              I consider this a bad bug, as it breaks a proxy server that I have been
              working on. Tomcat and other servlet containers seem to have gotten this
              right, why not Weblogic?
              Thanks
              Colin Evans
              Colin Evans
              Senior Engineer
              BITMO, Inc. (http://www.bitmo.com)
              (415)920.7225 / [email protected]
              

              Hi, it appears that the servlet mapping specified in section 10 of the
              Servlet 2.2 spec is broken in Weblogic server 6.0 GA. Here is the servlet
              2.2. spec for mapping:
              10.1 Use of URL Paths
              Servlet containers must use URL paths to map requests to servlets. The
              container uses the
              RequestURI from the request, minus the Context Path, as the path to map to a
              servlet. The URL
              path mapping rules are as follows (where the first match wins and no further
              rules are attempted):
              1. The servlet container will try to match the exact path of the request to
              a servlet.
              2. The container will then try to recursively match the longest path prefix
              mapping. This process
              occurs by stepping down the path tree a directory at a time, using the '/'
              character as a path
              separator, and determining if there is a match with a servlet.
              3. If the last node of the url-path contains an extension (.jsp for
              example), the servlet container
              will try to match a servlet that handles requests for the extension. An
              extension is defined as the
              part of the path after the last '.' character.
              4. If neither of the previous two 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 in this case.
              It appears that Weblogic does step #3 before step #2. This means that if
              you have a servlet called 'foo' mapped to '/foo/*' and Weblogic 6.0 receives
              a request for '/foo/bar.jsp', the container returns an error because it
              cannot find a JSP file called "bar.jsp" to compile, when according to the
              spec, servlet 'foo' should receive the request with the pathInfo value set
              to "/bar.jsp".
              The workaround is to assign all *.jsp files to the servlet 'foo' as well,
              but this breaks all other JSP files in the same web application.
              I consider this a bad bug, as it breaks a proxy server that I have been
              working on. Tomcat and other servlet containers seem to have gotten this
              right, why not Weblogic?
              Thanks
              Colin Evans
              Colin Evans
              Senior Engineer
              BITMO, Inc. (http://www.bitmo.com)
              (415)920.7225 / [email protected]
              

  • Servlet mapping with Apache + Tomcat

    I'm trying to set up my servlet with apache + Tomcat(3.2.3), and i'm using mod_jk as the Tomcat-Apache plug-in.
    The HelloWorld servlet that comes with the examples app worked fine at: http://localhost/examples/servlet/HelloWorldExample,
    but how do I change the configurations, so that it can be invoked at:
    http://localhost/examples/HelloWorldExample ?
    It appears to me that '/servlet/' is the default prefix for Tomcat's RequestInterceptor, there is no way to get around that.
    Any insights will be greatly appreciated, thanks!
    Elaine

    hi
    Try this:
    add below code in web.xml file in examples/WEB-INF
    F directory
    <servlet-mapping>
    <servlet-name>
    HelloWorldExample
    </servlet-name>
    <url-pattern>
    /HelloWorldExample
    </url-pattern>
    </servlet-mapping>
    Thanks for the reply, the web.xml is already set up this way, in fact, I'm able to invoke the servlet through tomcat(running on port 8080): http://localhost:8080/examples/HelloWorldExample,
    tomcat reads the web.xml without any problems.
    The problem comes from Apache(port 80), http://localhost:80/examples/HelloWorldExample wouldn't work, only http://localhost:80/examples/servlet/HelloWorldExample works.
    It appears to me that when requests are relayed from Apache to tomcat, you need to tell tomcat that you intend to invoke a servlet by prefixing '/servlet/', if you look in the server.xml, it has
    <RequestInterceptor
    className="org.apache.tomcat.request.InvokerInterceptor"
    debug="0" prefix="/servlet/" />
    I've tried to change this to something else, it didn't seem to make any difference.

  • About wls6.0 servlet mapping

              I do the wls6.0 servlet,I copy wls example helloservletExample in
              the mydomain\application\DefaultWebApp_myserver\web-inf\clsses\
              and modify the xml file
              <?xml version="1.0" ?>
              <!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>
              <servlet>
              <servlet-name>
              HelloWorldExample
              </servlet-name>
              <servlet-class>
              HelloWorldExample
              </servlet-class>
              </servlet>
              <servlet-mapping>
              <servlet-name>
              HelloWorldExample
              </servlet-name>
              <url-pattern>
              quickstart
              </url-pattern>
              </web-app>
              but when I run it http://localhost:7001/HelloWorldExample
              it said not found ,how can I resolve it,can anybody help me?
              

    1) Make sure you specified the correct class file name. If you copied from
              our examples directory it should be
              examples.servlets.HelloWorldServlet.
              2) Also your url-pattern was set to quickstart. So you should point y our
              browser to http://localhost/HelloWorldExamples/quickstart
              Read our docs
              Kumar
              blackwhites wrote:
              > I do the wls6.0 servlet,I copy wls example helloservletExample in
              > the mydomain\application\DefaultWebApp_myserver\web-inf\clsses\
              > and modify the xml file
              > <?xml version="1.0" ?>
              > <!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>
              > <servlet>
              > <servlet-name>
              > HelloWorldExample
              > </servlet-name>
              > <servlet-class>
              > HelloWorldExample
              > </servlet-class>
              > </servlet>
              > <servlet-mapping>
              > <servlet-name>
              > HelloWorldExample
              > </servlet-name>
              > <url-pattern>
              > quickstart
              > </url-pattern>
              > </web-app>
              > but when I run it http://localhost:7001/HelloWorldExample
              > it said not found ,how can I resolve it,can anybody help me?
              

  • How to handle manipulated servlet mapping entries?

    I am building a struts based web application with action url-pattern set to "*.do". During the test, I could break the application by enter wrong action name or wrong extentions such as "*.doo" .
    The global application exception handler won't handle this since it treat it as an correct action and try to look up it .
    For example, if the correct action mapping url is "member.do". I can break it by change to "mem.do" or "member.doo".
    The error message i got is:
    type Status report
    message /member.doo
    description The requested resource (/member.doo) is not available.
    Thanks all for the help!
    ---------------------------

    Your web.xml file is where you configure which requests get handled by the struts framework.
      <!-- Standard Action Servlet Mapping -->
      <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
      </servlet-mapping>This is where it says "anything ending with ".do" is handled by the struts action servlet.
    Is that what you mean maybe?
    BTW I don't think you should have to handle users typing in *.doo into the address bar. There have to be SOME limits.

  • How to check the whole values of a set of map exist in the vector of map?

    Hi Friends!
    I have a set of map; map<int, set<int>>myset;
    and a vector of map; map<int,vector<int>>myvec;
    myset contains;
    1=>11  16  30
    3=>2  11
    6=>2
    7=>9  12  16
    8=>9  13  16
    myvec contains;
    1=>11  15  21
    2=>16
    3=>11  16
    4=>2  13
    5=>11  16  30
    6=>9  5  10
    First, the first value of myset(11  16  30) will be checked with all the values of myvec, if the whole value(11  16  30) available at certain value in the myset, then it gives the key of myvec. So, the output for the first value is 5.
    Next, if you consider the value (2  11) in the myset, there are no matching values that contains whole 2  11 in the particular value in myvec. Therefore, what we do is, delete the last value of the current set, that is 11, and now consider 2 as
    the value and find the matching value from myvec. That is (2  13) and the key is 4.
    Like wise when we find the first possible match, then we print the key of myset immediately, there may be some other possible values available in the values of myset.
    I have written two functions that check the particular whole values of the myset matched with a particular values in myvec.
    bool IsValueInVec(int value, const IntVec& v2)
    IntVec::const_iterator itv=find (v2.begin(), v2.end(), value);
    if (itv!=v2.end())
    return true;
    return false;
    bool AreAllValuesInVec(const IntSet& s1, const IntVec& v2)
    for(set<int>::const_iterator sit=s1.begin();sit!=s1.end();++sit)
    if (!IsValueInVec((*sit), v2))
    return false;
    return true;
    Could anyone help me to solve this?

    You have neither a set of map nor a vector of map.  You have two maps.  Each contains keys of type int.  The mapped values of one are of type set<int>.  The mapped values of the other are of type vector<int>.  If
    you don't understand the types of the objects you are using, you will never be able to use them properly.
    Help you solve what?  Do the two functions you wrote perform as desired?  If not, provide a complete description of how what they do differs from what you want.
    Somewhere in code you have not shown, you need to call AreAllValuesInVec for a particular set and vector.  If this function returns false and if the set contains more than one element, you need to delete the last element of the set and try again. 
    If the set contains only a single element, you need to perform some "failure" processing that you have not described.  When the function returns true, you need to print the key of the map element which contains the vector.  What are you
    having trouble with?

  • A problem with servlet  mapping , using a servlet to produce some chart in

    Hi
    Thank you for reading my post.
    My problem is about using a Chart library which works well in jsf application but it does not works in JSF portlets.
    I think i find the problem but i do not know the solution.
    to use this charting library we should add a servlet to web.xml
    something like :
    <servlet>
    <servlet-name>Jenia internal servlet</servlet-name>
    <servlet-class>org.jenia.faces.util.Servlet</servlet-class>
    <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Jenia internal servlet</servlet-name>
    <url-pattern>/jenia4faces/*</url-pattern>
    </servlet-mapping>
    so , when we try to load a chart , it will make the chart image source
    something like
    http://localhost:28080/Adv/jenia4faces/chart/OAReport.jspBarChart3d_id0.png
    in the above sample , adv is the name of web application which is
    deployed in a servlet container.
    and filter applied to make the chart render-able.
    to use the chart library in jsf portlet , i add the servlet
    description as i did for web application , so i add
    <servlet>
    <servlet-name>Jenia internal servlet</servlet-name>
    <servlet-class>org.jenia.faces.util.Servlet</servlet-class>
    <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Jenia internal servlet</servlet-name>
    <url-pattern>/jenia4faces/*</url-pattern>
    </servlet-mapping>
    to my portlet web.xml file.
    when we have portlet , the url to access that portlet (which indeed is a
    web application) changes
    for example
    url for a sample portlet with same web application name
    will be like
    http:// localhost:28080/pluto/portal/Adv/
    as you can see there are some prefix to web application name in the url
    , but when i use chart component to show
    same chart , it still look for the chart in url like :
    http://localhost:28080/Adv/jenia4faces/chart/OAReport.jspBarChart3d_id0.png
    As you may already sugest , the image will not render because browser is
    looking in wrong place.
    now i
    think if i find some way to map that servlet to correct url
    pattern it will works.
    my question is :
    1-what will be new servlet url pattern ?
    2-is my assumption correct ?
    Thank you very much for reading such a long post

    i wrote an app i.e servlet which would select the data from the database and retrive the data.but i want to send this data to normal java file(which is not a servlet) and i want to display results in the normal java file.
    can any body help this concept........
    send me mail:[email protected]

  • How to find the most matched values in the set of map?

    Hi friends!
    I have two vectors
    vector<int> V1; vector<int> V2;
    and a map<int, set<int>> M1;
    I want to select common values from both V1 and V2 and check those values with the set in the map M1.
    For example:
    V1 contains;
    2  4  6  8  9
    V2 contains;
    4  5  6  9  10 
    M1 contains;
    1=>1  2  5  9
    2=>4
    3=>5   10
    4=>2  4  8
    5=>4   9
    6=>4   6
    7=>9  12
    When we select the common values of V1 and V2 it is 4, 6, 9.
    And we search for all 4, 6, 9 from the values of M1 which give more appropriate.
    But, no all values in the set of map.
    Then, we delete any value from 4, 6, 9, then remaining values would match any values from the map.
    From the example, if we delete 6, then remaining 4, 9 will match with 5=>4  9, or if we delete 9, then 6=>4   6. Any one of the keys can be selected.
    I know how to select the common values from V1 and V2, but I do not know how to match with the values and select the appropriate key from M1.
    Could anyone help me to solve this?

    This is not the question you asked, except perhaps in the subject. The subject is not the right place to put key features of the question. It is also important to use the body to ask just the question you want
    answered. For example your real question has nothing to do with V1 and V2, just the common vector V (e.g. 4 6 9).
    One way to solve your problem would be to create a new map
    map<int, set<int>> M2;
    with the same keys as M1. Each set of M2 should contain the elements of V that are
    not in the corresponding set of M1.
    Then pick the key of M2 that has the smallest set. If that set is empty, then the whole of V can be used. Otherwise the smallest set tells which elements of V have to be removed, and which is the desired key of M1.
    In your example, key 5 of M2 will contain just 6, so you should remove 6 from V and select key 5.
    Yes fine. I tried the following code and it creates the map M2 (NewMyMap in my code). But how to find the smallest set starting from size 1?
    #include <vector>
    #include <algorithm>
    #include <iostream>
    #include <map>
    #include <set>
    using namespace std;
    typedef vector<int> IntVec;
    typedef set<int> IntSet;
    typedef map<int, IntSet> SetMap;
    bool IsValueNotInSet(int value, IntSet& S);
    SetMap CreatNewSetMap();
    IntVec IVec; //This vector is for selecting certain keys from mySet map.
    IntVec myVec;
    SetMap mySet;
    SetMap NewMyMap;
    int main()
    IVec.push_back(3); IVec.push_back(4); IVec.push_back(5); IVec.push_back(6);
    myVec.push_back(4); myVec.push_back(6); myVec.push_back(9);
    IntSet tempS;
    tempS.insert(1); tempS.insert(2); tempS.insert(5); tempS.insert(9);
    mySet.insert(make_pair(1,tempS));
    tempS.clear();
    tempS.insert(4);
    mySet.insert(make_pair(2,tempS));
    tempS.clear();
    tempS.insert(5); tempS.insert(10);
    mySet.insert(make_pair(3,tempS));
    tempS.clear();
    tempS.insert(2); tempS.insert(4); tempS.insert(8);
    mySet.insert(make_pair(4,tempS));
    tempS.clear();
    tempS.insert(4); tempS.insert(9);
    mySet.insert(make_pair(5,tempS));
    tempS.clear();
    tempS.insert(4); tempS.insert(6);
    mySet.insert(make_pair(6,tempS));
    tempS.clear();
    tempS.insert(9); tempS.insert(12);
    mySet.insert(make_pair(7,tempS));
    cout<<"MYVEC\n";
    cout<<"-------------\n";
    for(IntVec::iterator itv = myVec.begin(); itv != myVec.end(); ++itv)
    cout<<(*itv)<<" ";
    cout<<"\n\n";
    cout<<"\nMYSET\n";
    cout<<"-------------";
    for(map<int,set<int>>::iterator its = mySet.begin(); its != mySet.end(); ++its)
    cout << endl << its->first <<" =>";
    for(IntSet::iterator sit=its->second.begin();sit!=its->second.end();++sit)
    cout<<" "<<(*sit);
    cout<<"\n\n";
    NewMyMap= CreatNewSetMap();
    cout<<"\nNEWMYSET\n";
    cout<<"-------------";
    for(map<int,set<int>>::iterator its1 = NewMyMap.begin(); its1 != NewMyMap.end(); ++its1)
    cout << endl << its1->first <<" =>";
    for(IntSet::iterator sit=its1->second.begin();sit!=its1->second.end();++sit)
    cout<<" "<<(*sit);
    cout<<"\n\n";
    return 0;
    bool IsValueNotInSet(int value, IntSet& S)
    IntSet::iterator it=find (S.begin(), S.end(), value);
    if (it!=S.end())
    return false;
    return true;
    SetMap CreatNewSetMap()
    IntSet TSet;
    for(IntVec::iterator it = IVec.begin(); it != IVec.end(); ++it)
    SetMap::iterator its = mySet.find(*it);
    if (its != mySet.end())
    TSet.clear();
    int key = its->first;
    IntSet& itset = its->second;
    for(IntVec::iterator itv = myVec.begin(); itv != myVec.end(); ++itv)
    if(IsValueNotInSet((*itv), itset))
    TSet.insert(*itv);
    NewMyMap.insert(make_pair(key,TSet));
    return NewMyMap;

  • How to specify  a servlet mapping as the url pattern with in the security constraints

    Hi ,
    Weblogic 6.0 documentation says the following:-
    Define which resources in the Web Application the security constraint applies to using the <url-pattern> element that is nested inside the <web-resource-collection> element. The <url-pattern> can refer to either a directory, filename or a <servlet-mapping>.
    To apply the security constraint to the entire Web Application, use the following <url-pattern>:
    <url-pattern>/*</url-pattern>
    Could any one let me know how to specify servlet mapping as the url pattern.
    I tried various combination and it doesn't seem to work and any help in this regard will be greatly appreciated.
    Thanks
    kannan

    The answer is posted here:
    Unapproved User Flag in UME

  • Problems with servlet mapping in 10g AS

    Hi There,
    i have a web application consisting of 2 controller servlets and use url mapping to send requests to the appropriate servlet, but i have a strange issue with 10g where it seems to be alternating between serlvets when handling requests!!!!
    the web.xml is like as follows (with the app having the root context '/app'):
    <servlet>
    <servlet-name>control1</servlet-name>
    <servlet-class>com.package1.class.name</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>control2</servlet-name>
    <servlet-class>com.package2.class.name</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>control2</servlet-name>
    <url-pattern>/special/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>control1</servlet-name>
    <url-pattern>/*</url-pattern>
    </servlet-mapping>
    therefore i'd expect a request like http://domain.name/app/special/content to be handled by the control2 servlet and http://domain.name/app/normal/content or http://domain.name/app/normal/special/content to be handled by the control1 servlet...
    but what seems to happen when requesting http://domain.name/app/special/content oc4j seems to alternate which servlet it passes it to...
    is there any reason why this might be happening (like some app server configuration), as i have other applications that are configured in the same way, and there's no problems with requests going to the wrong servlet.
    many thanks for your help,
    Andy

    In your integration process, define the import parameter under Configurable Parameters category.
    http://help.sap.com/saphelp_nwpi71/helpdata/en/44/1f1a5c932d0d19e10000000a114a6b/frameset.htm
    Regards,
    Prateek

  • Re: issue with servlet-mapping

    Hello,
    i got following url pattern on web xml and it works fine on resin, however,
    its gives me, java.lang.IllegalArgumentException: Invalid pattern,
    is there is a anyway to fix it without altering the file structure.
    <servlet-mapping>
            <servlet-name>FacesServlet</servlet-name>
            <url-pattern>/jsf/*.jsf</url-pattern>
        </servlet-mapping>

    Wildcards(*) can be used either at the beginning or end of the pattern.You cannot specify wildcards in the middle of the pattern.
    So, only either of these will work
    <servlet-mapping>
       <servlet-name>FacesServlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>Or
    <servlet-mapping>
       <servlet-name>FacesServlet</servlet-name>
       <url-pattern>/jsf/*</url-pattern>
    </servlet-mapping>

  • Different behaviour on servlet w/o servlet-mapping and init parameters

    I was playing around and found, that the init-parameter of a servlet is always null if there is no servlet mapping. I did not define a servlet mapping because I used the servlet only for for (named) dispatching (client usage should not be allowed).
    web.xml:
    <?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>InitParamServlet</servlet-name>
        <servlet-class>test.InitParamServlet</servlet-class>
        <init-param>
          <param-name>param1</param-name>
          <param-value>value1</param-value>
        </init-param>
      </servlet>
      <servlet-mapping>
        <servlet-name>InitParamServlet</servlet-name>
        <url-pattern>*.initparam</url-pattern>
      </servlet-mapping>
    </web-app>
    InitParamServlet.java:
    package test;
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class InitParamServlet extends HttpServlet{
      private static final long serialVersionUID = 1L;
      protected void doGet(HttpServletRequest request, HttpServletResponse response)
          throws ServletException, IOException {
        response.setContentType("text/html");
        PrintWriter pw = response.getWriter();
        pw.write(getServletName());
        pw.write(": param1=" + getInitParameter("param1"));
    }The URL http://localhost:8080/xxx/servlet/test.InitParamServletreturns org.apache.catalina.INVOKER.test.InitParamServlet: param1=null
    (on Tomcat), and the call to the same servlet with URL http://localhost:8080/xxx/test.initparamreturns InitParamServlet: param1=value1 instead (the correct init parameter value)!
    The same happens with jetty. This looks strange for me; I would expect the same behaviour for the servlet (independent from servlet-mapping-tag in the web.xml).

    When you call the url
    http://localhost:8080/xxx/servlet/test.InitParamServlet
    you are actually calling the invoker servlet that is defined in the default conf/web.xml. If you look at this web.xml file you will see that the invoker is mapped with the pattern "/servlet/*" which maps to the above url. The request goes to this servlet which parses the url and then calls the InitParamServlet class.
    When you call the url
    http://localhost:8080/xxx/test.initparam
    you are matching the url pattern you defined in the WEB-INF/web.xml file ("*.initparam"). This time the request goes to servlet instance that you defines in the servlet naming tags as "InitParamServlet" and since you defined init params they are populated.
    Note that these urls will also match the "*.initparam" pattern
    http://localhost:8080/xxx/XXXXX.initparam
    http://localhost:8080/xxx/badpackage.initparam
    http://localhost:8080/xxx/A.initparam
    Most people would have simplely defined the second servlet mapping as "initparam" and accessed the servlet with the url
    http://localhost:8080/xxx/initparam

  • Invalid element 'servlet-mapping' in content of 'web-app'

    Hello, JDev gurus!
    When compling, JDev 9.0.2.822 produce following error
    "oracle.xml.parser.v2.XMLParseException: Invalid element 'servlet-mapping' in content of 'web-app', expected elements '[taglib, resource-ref, security-constraint, login-config, security-role, env-entry, ejb-ref]'."
    on line <%@ taglib uri="http://xmlns.oracle.com/bibeans" prefix="orabi" %>
    This line was added automatically from component palette.
    How can I resolve this error?

    Hi,
    Did you change something into your web.xml file?
    Look at your web.xml. You must preserve the order given by the error message:
    Servlet-mapping
    session-config
    mime-mapping
    ejb-ref
    Jamil

  • 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.

Maybe you are looking for

  • My Mac Pro and Snow Leopard

    A list of things that happen since installing Snow L on Mac Pro -Stuttering boot up sound It is not always the same, sometimes stutters a lot sometimes it stutters two or three times. I never hear a normal boot up sound. -Random Lock ups/failing apps

  • Acrobat X Version 10.1.1 Print

    I have Acrobat X Version 10.1.1, and when printing a page, I launch Ctrl P to see the Print dialog box. Under Printer group, I type in the first letter of the printer's name, and the drop down list changes to the printer I want to print to. However,

  • Mutliple serveres in a two node RAC

    hello friends m i newbie in RAC and i have 7 servers in my company 4 are for oracle database used for different purposes having same instance name on each of them and 3 are for application servers used for different purposes having same instance name

  • Power adapter male pin BROKEN

    My son called today with power adapter problems...took awhile for me to figure it out, but the tip of the adapter pin has apparently broken off inside the computers female power port. (the pin is flush with the metal collar while it protrudes about 1

  • Keeping CMS database and FRS backups in synch

    I am in the process of upgrading to BOE XI R3.1 from CE 10 and am looking at our backup and recover plan. We are planning on implementing 2 BOE Xi R3.1 servers with a clustered CMS.  Our CMS database will be running on a remote SQL Server (2005) farm