2010-09-20 8 views

risposta

6

mi consiglia di utilizzare la console di pesci vetro e aggiungere un alloggio qui:

Configurazione | Virtual Server | Server

nome: send-error_1

valore: codice = 404 percorso =/tmp/404.html reason = Resource_not_found

Aumentare il numero per diversi rors, eg. send_error_2,3,4 ...

I percorsi sono assoluti o relativi alla cartella del dominio.

Dai un'occhiata alla http://javadude.wordpress.com/2010/12/07/customized-error-pages-for-glassfish-v3/

+0

Sto cercando di replicare questo, utilizzando il link qui sopra eccellente. Tuttavia, la pagina di errore HTML che impostiamo con path = ritorna nel browser come testo normale con tutti i tag HTML visibili. Qualche idea? – iaindownie

8

Creare una pagina 404.htm

Es:

<!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> 

e salvarlo come 404.htm e aggiungerlo ai vostri

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

Es:

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

Invio:

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

Aggiungi nuova proprietà al server

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

enter image description here enter image description here enter image description here

Problemi correlati