Java:Web工程中设置404页面

Java:Web工程中设置404页面

在web.xml中加入以下内容即可:

    <error-page>

        <error-code>404</error-code>

        <location>/404.html</location>

    </error-page>


====================================== 404.html ======================================

<!DOCTYPE html>

<html>

<title>Nothing found</title>

<style type="text/css">

img {

position: absolute;

left: 50%;

top: 50%;

margin-left: -200px;

margin-top: -209px;

}

</style>

<body>

    <img src="images/404.jpg" />

</body>

</html>

你可能感兴趣的:(Java:Web工程中设置404页面)