5

GlassFish 3.0.1 Community Editionでデフォルトのエラーページ(ステータス404-見つかりません)を変更するにはどうすればよいですか?

4

2 に答える 2

11

ページ 404.htm を作成します。

元:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>404 - Page not found.</title>
    <style type="text/css">
        body{
            font-family:tahoma;
        }
    </style>
</head>
<body>
    <div class="firstWarning">Page not found.</div>
    <img src="css/images/404.jpg" class="imgWarning" />
</body>
</html>

404.htm として保存し、

${com.sun.aas.instanceRoot}/docroot/

元:

/usr/share/glassfish3/glassfish/domains/domain1/docroot/

入る:

https://ip_address:4848/web/configuration/virtualServerEdit.jsf?name=server&configName=server-config

新しいプロパティをサーバーに追加

Name:send-error_1
Value:code=404 path=${com.sun.aas.instanceRoot}/docroot/404.htm reason=Resource_not_found
Description: 404 Error Page

ここに画像の説明を入力 ここに画像の説明を入力 ここに画像の説明を入力

于 2012-11-27T13:28:00.530 に答える
8

Glassfish コンソールを使用して、ここにプロパティを追加することをお勧めします。

構成|仮想サーバー|サーバー

名前: send-error_1

値: code=404 path=/tmp/404.html reason=Resource_not_found

いくつかのエラーの数を増やします。send_error_2,3,4...

パスは、ドメイン フォルダーに対して絶対パスまたは相対パスのいずれかです。

http://javadude.wordpress.com/2010/12/07/customized-error-pages-for-glassfish-v3/をご覧ください。

于 2010-12-07T07:00:08.917 に答える