如何更改 GlassFish 3.0.1 社区版中的默认错误页面(状态 404 - 未找到)?
问问题
15299 次
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 控制台并在此处添加一个属性:
配置|虚拟服务器|服务器
名称:发送错误_1
值:代码=404 路径=/tmp/404.html 原因=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 回答