Regular expression in url-pattern in web.xml

hi,
could any tell me the is web.xml accepts regexp(except wild card) in it's url-pattern attribute. I want to put regular expression (except wildcard, i know it supports) as [a-zA-Z]+ like in url-pattern in servlet-mapping. I tried this :
<servlet-mapping>
<servlet-name>AppDnldMain</servlet-name>
<url-pattern>/[a-zA-Z]+/?</url-pattern>
</servlet-mapping>
But it dint work.. I dont know whether i processed in right way. Any suggestion are most welcome..

No it does not accept wild card.
Servlet specification section SRV.11.2
In theWeb 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.
If you want regex matching, you can match all urls to a single servlet, and then use request.getRequestURI and do regex on that in your code.
Cheers,
evnafets

Similar Messages

  • Bug when specifying url-pattern in web.xml

    Hi
              I have been using Weblogic 6.0 Beta and managed to specify the following
              security constraint
              <security-constraint>
              <web-resource-collection>
              <web-resource-name>SecurePages</web-resource-name>
              <description>no description</description>
              <url-pattern>/control/signin</url-pattern>
              <url-pattern>/control/refreshUser</url-pattern>
              <url-pattern>/control/updateUser</url-pattern>
              <url-pattern>/control/deleteaddress</url-pattern>
              <url-pattern>/control/updateaddress</url-pattern>
              <url-pattern>/control/refreshcontacts</url-pattern>
              <url-pattern>/control/updatecard</url-pattern>
              <http-method>POST</http-method>
              <http-method>GET</http-method>
              </web-resource-collection>
              </security-constraint>
              This works fine as you would expect. I have upgraded to Weblogic 6.0 Service
              Pack 1 Rolling Patch 1 and the same web.xml file no longer works. When you
              try and start the server Weblogic hangs just after loading the Oracle driver
              that I use.
              The odd behaviour is that if I change the order of the url-pattern elements
              so that the updatecard URL is above the refreshUser URL the server starts!
              (shown below)
              <url-pattern>/control/signin</url-pattern>
              <url-pattern>/control/updatecard</url-pattern>
              <url-pattern>/control/refreshUser</url-pattern>
              <url-pattern>/control/updateUser</url-pattern>
              <url-pattern>/control/deleteaddress</url-pattern>
              <url-pattern>/control/updateaddress</url-pattern>
              <url-pattern>/control/refreshcontacts</url-pattern>
              A deadlock condition appears to occur, a section of the thread dump looks
              like:
              "Reference Handler" daemon prio=10 tid=0x8990b20 nid=0x7dc waiting on
              monitor [0
              x8c0f000..0x8c0fdc4]
              at java.lang.Object.wait(Native Method)
              at java.lang.Object.wait(Object.java:420)
              at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:110)
              "main" prio=5 tid=0x234ce0 nid=0x6cc runnable [0x6e000..0x6fc3c]
              at weblogic.servlet.utils.URLMatchMap.put(URLMatchMap.java:156)
              at
              weblogic.servlet.security.internal.WebAppSecurity.setConstraints(WebA
              ppSecurity.java:77)
              Looking at the weblogic.jar file the URLMatchMap class is a new addition
              over the original Weblogic 6.0. It seems that the put method of the
              URLMatchMap may be going into an infinite loop, dependant on the URLs that
              are being entered. The fact that changing the order of the URLs overcomes
              the bug seems to suggest there may be some coding error in this new class.
              A fix would be great if anyone has one.
              Chris Mein
              

              Just wondering if anyone ever came up with the solution to the bug with WL 6.0
              sp1, mentioned by Chris, below. Any information on this would be greatly appreciated.
              Tony
              "Chris Mein" <[email protected]> wrote:
              >Hi
              >
              >I have been using Weblogic 6.0 Beta and managed to specify the following
              >security constraint
              >
              ><security-constraint>
              > <web-resource-collection>
              > <web-resource-name>SecurePages</web-resource-name>
              > <description>no description</description>
              > <url-pattern>/control/signin</url-pattern>
              > <url-pattern>/control/refreshUser</url-pattern>
              > <url-pattern>/control/updateUser</url-pattern>
              > <url-pattern>/control/deleteaddress</url-pattern>
              > <url-pattern>/control/updateaddress</url-pattern>
              > <url-pattern>/control/refreshcontacts</url-pattern>
              > <url-pattern>/control/updatecard</url-pattern>
              > <http-method>POST</http-method>
              > <http-method>GET</http-method>
              > </web-resource-collection>
              > </security-constraint>
              >
              >This works fine as you would expect. I have upgraded to Weblogic 6.0
              >Service
              >Pack 1 Rolling Patch 1 and the same web.xml file no longer works. When
              >you
              >try and start the server Weblogic hangs just after loading the Oracle
              >driver
              >that I use.
              >
              >The odd behaviour is that if I change the order of the url-pattern elements
              >so that the updatecard URL is above the refreshUser URL the server starts!
              >(shown below)
              >
              ><url-pattern>/control/signin</url-pattern>
              ><url-pattern>/control/updatecard</url-pattern>
              ><url-pattern>/control/refreshUser</url-pattern>
              ><url-pattern>/control/updateUser</url-pattern>
              ><url-pattern>/control/deleteaddress</url-pattern>
              ><url-pattern>/control/updateaddress</url-pattern>
              ><url-pattern>/control/refreshcontacts</url-pattern>
              >
              >A deadlock condition appears to occur, a section of the thread dump looks
              >like:
              >
              >"Reference Handler" daemon prio=10 tid=0x8990b20 nid=0x7dc waiting on
              >monitor [0
              >x8c0f000..0x8c0fdc4]
              > at java.lang.Object.wait(Native Method)
              > at java.lang.Object.wait(Object.java:420)
              > at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:110)
              >
              >"main" prio=5 tid=0x234ce0 nid=0x6cc runnable [0x6e000..0x6fc3c]
              > at weblogic.servlet.utils.URLMatchMap.put(URLMatchMap.java:156)
              > at
              >weblogic.servlet.security.internal.WebAppSecurity.setConstraints(WebA
              >ppSecurity.java:77)
              >
              >Looking at the weblogic.jar file the URLMatchMap class is a new addition
              >over the original Weblogic 6.0. It seems that the put method of the
              >URLMatchMap may be going into an infinite loop, dependant on the URLs
              >that
              >are being entered. The fact that changing the order of the URLs overcomes
              >the bug seems to suggest there may be some coding error in this new class.
              >
              >A fix would be great if anyone has one.
              >
              >Chris Mein
              >
              >
              

  • How to use a wild card for url pattern in web.xml?

              I want to use web container managed security to protect all my JSP pages. I tried
              to use the <security-constraint> tag in web.xml and set <url-pattern> to /*.
              However, none of my pages is protected. Specifying each page individually works,
              but I really don't want to do that. Any ideas?
              

    Eric:
              Which version of WebLogic Server are you using (including any service pack or rolling
              patches)?
              Eric Ma wrote:
              > I want to use web container managed security to protect all my JSP pages. I tried
              > to use the <security-constraint> tag in web.xml and set <url-pattern> to /*.
              > However, none of my pages is protected. Specifying each page individually works,
              > but I really don't want to do that. Any ideas?
              Jim Brown
              Developer Relations Engineer
              BEA Support
              

  • "Match Regular Expression" and "Match Pattern" vi's behave differently

    Hi,
    I have a simple string matching need and by experimenting found that the "Match Regular Expression" and "Match Pattern" vi's behave somewhat differently. I'd assume that the regular expression inputs on both would behave the same. A difference I've discovered is that the "|" character (the "vertical bar" character, commonly used as an "or" operator) is recognized as such in the Match Regular Expression vi, but not in the Match Pattern vi (where it is taken literally). Furthermore, I cannot find any documentation in Help (on-line or in LabVIEW) about the "|" character usage in regular expressions. Is this documented anywhere?
    For example, suppose I want to match any of the following 4 words: "The" or "quick" or "brown" or "fox". The regular expression "The|quick|brown|fox" (without the quotes) works for the Match Regular Expression vi but not the Match Pattern vi. Below is a picture of the block diagram and the front panel results:
    The Help says that the Match Regular Expression vi performs somewhat slower than the Match Pattern vi, so I started with the latter. But since it doesn't work for me, I'll use the former. But does anyone have any idea of the speed difference? I'd assume it is negligible in such a simple example.
    Thanks!
    Solved!
    Go to Solution.

    Yep-
    You hit a point that's frustrated me a time or two as well (and incidentally, caused some hair-pulling that I can ill afford)
    The hint is in the help file:
    for Match regular expression "The Match Regular Expression function gives you more options for matching
    strings but performs more slowly than the Match Pattern function....Use regular
    expressions in this function to refine searches....
    Characters to Find
    Regular Expression
    VOLTS
    VOLTS
    A plus sign or a minus sign
    [+-]
    A sequence of one or more digits
    [0-9]+
    Zero or more spaces
    \s* or * (that is, a space followed by an asterisk)
    One or more spaces, tabs, new lines, or carriage returns
    [\t \r \n \s]+
    One or more characters other than digits
    [^0-9]+
    The word Level only if it
    appears at the beginning of the string
    ^Level
    The word Volts only if it
    appears at the end of the string
    Volts$
    The longest string within parentheses
    The first string within parentheses but not containing any
    parentheses within it
    \([^()]*\)
    A left bracket
    A right bracket
    cat, cag, cot, cog, dat, dag, dot, and dag
    [cd][ao][tg]
    cat or dog
    cat|dog
    dog, cat
    dog, cat cat dog,cat
    cat cat dog, and so on
    ((cat )*dog)
    One or more of the letter a
    followed by a space and the same number of the letter a, that is, a a, aa aa, aaa aaa, and so
    on
    (a+) \1
    For Match Pattern "This function is similar to the Search and Replace
    Pattern VI. The Match Pattern function gives you fewer options for matching
    strings but performs more quickly than the Match Regular Expression
    function. For example, the Match Pattern function does not support the
    parenthesis or vertical bar (|) characters.
    Characters to Find
    Regular Expression
    VOLTS
    VOLTS
    All uppercase and lowercase versions of volts, that is, VOLTS, Volts, volts, and so on
    [Vv][Oo][Ll][Tt][Ss]
    A space, a plus sign, or a minus sign
    [+-]
    A sequence of one or more digits
    [0-9]+
    Zero or more spaces
    \s* or * (that is, a space followed by an asterisk)
    One or more spaces, tabs, new lines, or carriage returns
    [\t \r \n \s]+
    One or more characters other than digits
    [~0-9]+
    The word Level only if it begins
    at the offset position in the string
    ^Level
    The word Volts only if it
    appears at the end of the string
    Volts$
    The longest string within parentheses
    The longest string within parentheses but not containing any
    parentheses within it
    ([~()]*)
    A left bracket
    A right bracket
    cat, dog, cot, dot, cog, and so on.
    [cd][ao][tg]
    Frustrating- but still managable.
    Jeff

  • Regular expressions for URLs to match extensions

    I am working on a simple method that will assign a specific extension
    (e.g. ".jsp", ".php", ".cfm", etc.) to the end of a URL if it doesn't
    find anything marking a valid extension, however, I do not want to add
    an extension if one is found.
    Consider my code:
    import java.util.regex.Pattern;
    public static final String urlEndSlashPattern = "/?";
    public static final String urlQSPattern = "\\??([a-zA-Z0-9\\-_\\.]
    +=[^&]*&?)*";
    public static final String urlAnchorPattern = "#[^#]*$";
    public static void addExtToUrl(String url, String myExt, String[]
    exts) {
       StringBuffer sb = new StringBuffer();
       boolean hasExt = false;
       for (int i = 0; i < exts.length; i++) {
    sb.append(".").append(exts).append(urlEndSlashPattern).append(urlQSPatte�rn).append(urlAnchorPattern);
    if (Pattern.matches(sb.toString(), url)) {
    hasExt = true;
    sb = new StringBuffer();
    if (!hasExt) {
    url += "." + myExt;
    The issue I want to bring up is the regular expression pattern I'm
    using appears to fail.  I want to check and see if the URL I provide
    ends with a valid extension, followed by optional "/" or a query
    string or an anchor or any combination of these.
    Like say if I have
    http://www.blah.com/index.html
    Then don't add the ".jsp" extension
    But if I have
    http://www.blah.com/registration/
    Then I *want* to add the ".jsp" extension:
    http://www.blah.com/registration.jsp
    Or if I have:
    http://www.blah.com/registration/?foo=bar#baz
    Then it needs to change to
    http://www.blah.com/registration.jsp?foo=bar#baz
    But if I have
    http://www.blah.com/registration/index.php?foo=bar#baz
    Then I do *not* add the ".jsp" extension.
    Hope that makes sense now.  Bottom line is that the pattern above
    doesn't seem to work.  Ideas?
    Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Ok, just for fun, let's try it.
    URL: http://www.blah.com/?bar=baz#anchor
    Absolutely valid URL and something possible (remember, Balus, this is from a database entry, thus, it can be anything at all!)
    Let's split onto the last /
    Your last entry will be
    ?bar=baz#anchor
    So if I re-insert the .jsp that it would not find I get
    http://www.blah.com/.jsp?bar=baz#anchor
    INVALID URL
    Now let's try this one, BalusC:
    http://www.blah.com/index.jsp?forwardURL=http://www.wee.com/gotcha_balus/
    Now we split according to the ... last /
    http://www.blah.com/index.jsp?forwardURL=http://www.wee.com/gotcha_balus.jsp
    Valid URL, but possibly wrong when the query string value for "forwardURL" is read, thus, making the URL ultimately wrong.
    Two examples that show that splitting by the last / can't work here.

  • Maintaining Portal Desk top URL aliases in web.xml file

    Hi All,
    I am planning to configure portal url alias i.e http://localhost:53000/irj/portal/finance
    should take me directly to finance portal desk top.
    1) Created a Desktop named finance_desktop
    2) Master rule has been set for URL Alias.
    3) I need to set URL alias name: finance in web.xml file
    4) path for the web.xml file is C:\usr\sap\SID\JCXX\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\web.xml
    5) Where exactly i have to change web.xml  file
    Infact i have seen a pdf "How to configure the J2ee engine deployment descriptor"
    Thanks in advance
    Regards,
    Murali

    Hi
    indeed one small copy/paste mistake from me ... sorry for that...
    After you copyed the large chunk of code (as i discribe in step 1 and 2) you must rename:
    <param-name>portal</param-name>
    to
    <param-name>portal/finance</param-name>
    so then that part of the web.xml will look like this:
    <init-param>
    <param-name>portal</param-name>
    <param-value>
    anonymous=0,proxy=0,low_bandwidth=0,include_in_url=1,include_application_name_in_url=1
    </param-value>
    </init-param>
    <init-param>
    <param-name>portal/finance</param-name>
    <param-value>
    anonymous=0,proxy=0,low_bandwidth=0,include_in_url=1,include_application_name_in_url=1
    </param-value>
    </init-param>
    Good luck again...
    Cheers,
    Benjamin Houttuin
    Message was edited by:
            Benjamin Houttuin

  • Regular expressions for URLs

    Hi everyone,
    I have a question about regular expressions.
    Let's say I want my program to extract last 10-digits from any URL that will be found (every found URL will end up on 10digit number!) and insert that number in the middle of other URL.
    Would anyone tell me please how to do that?
    Thank you

    I am not sure how to do that either...
    Actually I just figured out that there is no garantee that the URL will be ended on 10-digit number.
    Ok, my program is meant to search for the movie info on Yahoo (user enters keyword to search and chooses either 'title', 'actor', 'trailer', 'review' in drop-down menu). After the 'search' button is clicked the appropriate page is supposed to be found.
    For example, if the user types in 'shrek' and chooses 'trailer', the result is supposed to be this link http://movies.yahoo.com/movie/1808405861/trailer and not the
    following ones:
    http://movies.yahoo.com/mv/search?p=shrek
    or
    http://movies.yahoo.com/shop?d=hv&cf=info&id=1808405861
    So in my program the line for the 'title' search is
    url = "http://movies.yahoo.com/mv/search?type=all&p=";and it works for the titles. I thought if the found link has 10 -digit number on the end I can somehow 'catch' that number and insert into another link -so the page with trailers would be pulled up (it's an ID number in yahoo database) .
    But now since I am not sure if 10-digit number is going to be in the found link at all, I have no idea how to 'catch' that number.
    Does anyone have any ideas for my case?

  • Need a regular expression for URL

    Regular expression: ^(udp|norm)://(?:(?:25[0-5]|2[0-4]\\d|[01]\\d\\d|\\d?\\d)(?(?=\\.?\\d)\\.)){4}:(6553[0-5]|655[0-2][0-9]\\d|65[0-4](\\d){2}|6[0-4](\\d){3}|[1-5](\\d){4}|[1-9](\\d){0,3})$
    Source: udp://125.3.4.121:23456
    Getting error:java.util.regex.PatternSyntaxException: Unknown inline modifier near index 54
    ^(udp|norm)://(?:(?:25[0-5]|2[0-4]\d|[01]\d\d|\d?\d)(?(?=\.?\d)\.)){4}:(6553[0-5]|655[0-2][0-9]\d|65[0-4](\d){2}|6[0-4](\d){3}|[1-5](\d){4}|[1-9](\d){0,3})$

    paulcw wrote:
    I can't help wondering if a simpler solution would involve creating a java.net.URL object, passing it the string to be checked, and let URL do the parsing and an initial pass at checking the syntax. Then you could query URL for individual components for further checking (e.g., getting the transfer type to make sure it's one of the kinds you want). This approach would probably be more self-documenting, if nothing else.Nice idea, but java.net.URL doesn't actually do much work at all. It basically takes the protocol part, looks up a handler for it, and delegates everything else to that. The handlers themselves are down in the sun packages (or whatever your Java impl is) and since there isn't one for the OPs protocol, he'd have to write and register his own anyway, which kind-of negates the entire purpose of leveraging it.
    @OP: Paul's suggestion can still be of use. Apache, Codehaus and the like will have written their own protocol handlers, it's worth grabbing the source code for, say, Apache HttpClient, and seeing if they've got anything useful in there. Then again, who's to say that what's a valid URL for this 'norm' protocol, other than whoever designed the protocol?

  • Regular Expression for Match Pattern (string) Function

    I need to find a variable length string enclosed by brackets and
    within a string. Can't seem to get the regular expression right for
    the Match Pattern function. I'm able to get the job done using the
    Token function, but it's not as slick or tight as I'd like. Does
    anybody out there have the expression for this?

    Jean-Pierre Drolet wrote in message news:<[email protected]>...
    > The regular expression is "\[[~\]]*\]" which means:
    > look for a bracket "\[" (\ is the escape char)
    > followed by a string not containing a closing bracket "[~\]]*"
    > followed by a closing bracket "\]". The match string include the
    > brackets
    >
    > You can also read "Scan from String" with the following format:
    > "%[^\[]\[%[^\[\]]" and read the 2nd output. The brackets are removed
    > from the scanned string.
    Thanks, Jean_Pierre
    I did some more experimenting after posting and found that \[.*\] also
    works with the match pattern function. Thanks for your input.
    sm

  • Regular expression alarm url

    Hi,
    I have a problem with regular expression. I would like to filter only the name of a dsc alarm url: \\EW-MONITOR\monitor\000_t-ist_STB-M1-AS.Alarms.HI should be 000_t-ist_STB-M1-AS . Has somebody an hint for me?
    Best Regards,
    Joachim
    Solved!
    Go to Solution.

    Joachim082 wrote:
    Hi,
    I have a problem with regular expression. I would like to filter only the name of a dsc alarm url: \\EW-MONITOR\monitor\000_t-ist_STB-M1-AS.Alarms.HI should be 000_t-ist_STB-M1-AS . Has somebody an hint for me?
    Best Regards,
    Joachim
    What will be constant in the name?  Will it always be between "monitor/" and ".Alarms"?  Will the format always be "###_<some text>_<other text>"?
    This will be easy once I know what to look for.
    Jim
    You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice

  • Regular Expression for match pattern

    Hi guys, I need some help.
    In one part of my test system, I give to the program a sequence of temperatures, which are numbers separated by a comma. Due to a possible error, the user can  forget the coma, and the program gets unexpected values.
    For example, "20, 70, -10" is a right value, whereas "20 70, -10" would be a wrong one.
    Which regular expression will detect this comma absence?
    Thanx in advance.

    OK, makes it more difficult (and more fun )
    My original version failed also when the space was forgotten.  DOH!
    Try this version.  It get's complicated cause the scan from string likes ignoring spaces... So we change the spaces
    Hope this helps
    Shane.
    PS The ideas given by others are still a better solution, but if you're stuck........
    Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
    Attachments:
    Check input string with commas(array).vi ‏39 KB

  • PHP Regular Expression of URL in text

    I have some text that is displaying from a database table and
    inside
    that text is a web address (i.e.,
    http://www.whateverthisaddressis.com).
    I'd like to know if anyone has a code out there to where php
    can find
    text with a
    http:// or www. and change it into a link
    automatically. I
    know there's many out there, but I don't have a clue what I'm
    looking at
    and where to put it.
    Any help would be greatly appreciated!
    Toad78

    You might find something here:
    http://ca3.php.net/preg_replace

  • Regular Expression Capturing Repeated Patterns

    I have a string pattern that looks like "PartList ABC1 TO ABC20" and some times it looks like  "PartList ABC1 TO ABC20 AND XYZ1 to XYZ15". The string indicates a part type and the range of part numbers in the list. 
    I am interested in capturing the type and the range of numbers.  I created a regex pattern that allows me to handle the list when only one type is listed. My problem is that I don't know how to build the pattern to handle the list when two part types
    are listed.  Can someone help?
    The pattern I have is:
    "(?<Min>\d+)(\s)?TO(\s)?(?<PartType>([A-Z]+[-]?))?(?<Max>\d+)"

    I went completely wrong about it.  I need to make sure that the string is either in the form
    1- Part List (or whatever) followed by "ABC1 TO ABC20"
    or
    2- "Part List (or whatever) followed by "ABC1 TO ABC20 AND XYZ1 TO XYZ15"
    First I need to validate it making sure it conforms to either forms, then I need to capture the part type and the range of part numbers for either form.
    I think that I need to make sure that the string contains "([A-Z]+\d+)(\sTO\s)([A-Z]+\d+)"  one or two times.
    If I use the pattern "\sTO\s" as a central point I could do this
    "(?<Min>(\d+(?=\sTO\s)))"  to get the Min
    "((?<=\sTO\s)(?<PartType>([A-Z]+)))" to get the part type
    "((?<=\sTO\s[A-Z]+[-]?)(?<Max>\d+))" to get the Max
    Now I don't know how to combine these patterns to work together to validate the string and capture the groups for either form of the string.  Please help.  I am going nuts with this.

  • Url pattern tag and regular expression

    I am trying to set up my web.xml in Tomcat 4.1.3 container to go to one page if letters are entered in last part of url or go to another page if numbers are entered in the last part of a url.
    For example if here is how the url would be set up where the url will go to either the all numbers location or the non numbers location:
    Any number entry for last part of url which could be something like 343
    http://127.0.0.1:8080/theapp/pack/weburl/343
    Any non number entry for last part of url which could be something like abec
    http://127.0.0.1:8080/theapp/pack/weburl/abec
    My attempt below is not working because it doesnt seem to take the regular expressions. But if I manually put in letters such as: <url-pattern>/pack/weburl/ab</url-pattern> it would take me to the correct page. How does web.xml work with regular expressions inthe url-pattern tag??
    <servlet>
    <servlet-name>Number</servlet-name>
    <servlet-class>pack.Number</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>Number</servlet-name>
    <url-pattern>/pack/weburl/\d*</url-pattern>
    </servlet-mapping>
    <servlet>
    <servlet-name>NotNumber</servlet-name>
    <servlet-class>pack.NotNumber</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>NotNumber</servlet-name>
    <url-pattern>/pack/weburl/[A-Za-z]</url-pattern>
    </servlet-mapping>

    Sorry, this pattern can't take regular expressions.
    Referring to the servlet spec section 11.2 which defines these mappings
    In the web application deployment descriptor, the following syntax is used to define
    mappings:
    � A string beginning with a �/� character and ending with a �/*� postfix 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.As an alternative, I would suggest that you match the request to a filter, and then use some logic based on request.getURI() to determine which resource to forward to from there.

  • URL Mapping for packaged JSP's in web.xml file

              Hi,
              I am using weblogic6.0sp2 enterprise edition.I have my JSP's in package structure.
              Suppose my login.jsp is in package com.advice.document. So for URL mapping in
              web.xml what should be given so that by giving that my JSP runs. I have tried
              many options but not got success.
              Here is my web.xml file..
              <web-app>
              <servlet>
              <servlet-name> Login </servlet-name>
              <jsp-file> com\advice\document\login.jsp</jsp-file>
              </servlet>
              <servlet-mapping>
              <servlet-name> Login </servlet-name>
              <url-pattern> /Login</url-pattern>
              </servlet-mapping>
              </web-app>
              If any body knows or have worked on the same then let me know.
              Thanks in advance.
              --- Vipul
              

    Did you try specifying the jsp-file with forward slashes (e.g.,
              com/advice/document/login.jsp)?
              Vipul Garg wrote:
              > Hi,
              > I am using weblogic6.0sp2 enterprise edition.I have my JSP's in package structure.
              > Suppose my login.jsp is in package com.advice.document. So for URL mapping in
              > web.xml what should be given so that by giving that my JSP runs. I have tried
              > many options but not got success.
              > Here is my web.xml file..
              > <web-app>
              > <servlet>
              > <servlet-name> Login </servlet-name>
              > <jsp-file> com\advice\document\login.jsp</jsp-file>
              > </servlet>
              > <servlet-mapping>
              > <servlet-name> Login </servlet-name>
              > <url-pattern> /Login</url-pattern>
              > </servlet-mapping>
              > </web-app>
              >
              > If any body knows or have worked on the same then let me know.
              > Thanks in advance.
              > --- Vipul
              

Maybe you are looking for