How to define a url not found servlet mapping in web.xml?
Posted
by user246114
on Stack Overflow
See other posts from Stack Overflow
or by user246114
Published on 2010-06-12T15:42:59Z
Indexed on
2010/06/12
15:52 UTC
Read the original article
Hit count: 188
Hi,
I have a web app, I want to define my index.jsp file to be shown when the entered url is like:
www.mysite.com
www.mysite.com/
www.mysite.com/index.jsp
but if any other url is entered, like:
wwww.mysite.com/g
I want a particular servlet to handle the request. In my web.xml file, I am doing this:
<servlet>
<servlet-name>ServletCore</servlet-name>
<servlet-class>com.me.test.ServletCore</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ServletCore</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
so that is letting the ServletCore servlet pick up any url, but as expected it is taking over even the:
www.mysite.com/index.jsp
type urls. How can I define it in such a way to work how I want?
Thank you
© Stack Overflow or respective owner