Forums Register Login

Question on Servlet mapping

+Pie Number of slices to send: Send
Hi,

I need to call my servlet for all the url patterns for */FCExporter, however servlet mapping like



seems inappropriate.

Basically i want to hit this servlet whenever the last token is /FCExporter.

Any pointers..how this can be done?

Thanks,
Manish Ramrakhiani
1
+Pie Number of slices to send: Send
 

view plaincopy to clipboardprint?
<servlet-mapping>
<servlet-name>FCExporter</servlet-name>
<url-pattern>*/FCExporter</url-pattern>
</servlet-mapping>

seems inappropriate.

Basically i want to hit this servlet whenever the last token is /FCExporter.



Why it seems inappropriate?

You would have configured <servlet> tag with <servlet-name> & <servlet-class>. And everytime whenever the request is from "/FCExporter", your servlet class (configured in <servlet-class>) will be called,provided you have correctly configured it.

Also remember, does not refers to servlet class
+Pie Number of slices to send: Send
yes as kunal said <servlet-name> which is configured in web.xml is used during object creation of your servlet component/program by the container..
you can see it practically when you execute your web application,just look the log files or tomcat.exe console application.... you can know each and every activity done on your servlet program by the container even you can see the exceptions also.. when encountered...

+Pie Number of slices to send: Send
but url pattern can be of three type:

1)exact match.. example:
here the url pattern starts with "/" can have any charactters except *,where * include , .extension etc
<url-pattern>/myurlpattern</url-pattern>

2)extension-match:
<url-pattern>*.extension</url-pattern>//*-->can be abc,123or even abc/123/a/b
(so on) ...
example:

<url-pattern>/abc.c</url-pattern>//here .c is the extension and must be at last
<url-pattern>/a/b/c.do/123.x</url-pattern>//

3)directory match:
must begin with "/" and end with "*",multiple words or characters must be seperated by "/'
example:
<url-pattern>/abc/x/y/z.c</url-pattern>

if you write any url-pattern other than the above (not as in examples) url patterns that is exact match,extension match,directory match) then container doesn't recognize the url pattern mentioned in web.xml more over you get exception...


pie. tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1073 times.
Similar Threads
servlet-mapping tag in web.xml
Tiles not picking up stylesheet in Spring app
Upgrading to Tomcat6 problems
A 404 Error, need help configuring web.xml
Problem in spring mvc configuration
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 04:33:10.