开发者

handle error when change domain name

I want to handle 404 error when change the domain name, here's the domain name

http://localhost:8080/OnlineQuerySystemNew/

when I change any letter 404 error occurs even 开发者_JAVA技巧I make custom error page in web.xml

<error-page>
    <error-code>404</error-code>
    <location>/ErrorPage.jsp</location>
</error-page>


I assume that you mean "context name" when you said "domain name"? The context name is like the OnlineQuerySystemNew part in your example. The domain name is the localhost part in your example (which is actually not a real domain name, but you get the point).

The 404 error page in webapp's web.xml only applies to 404 errors in webapp's own context, not in other contexts. So it only kicks in when you do like http://localhost:8080/OnlineQuerySystemNew/peekaboo

To achieve your requirement, you need to deploy a ROOT webapp in Tomcat and put and configure the desired error page right there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜