Hi guys,
I've followed the wiki [1] for handling server errors. (e.g. 500, 404)
The page that I have made for this displays fine. But when I try to add
a button for the user to navigate to another page, it does nothing. Such
a button is necessary because simply hitting the "back" button on their
browsers will most likely leave them at the same page, staring at the
error message.
I have tried both h:commandButton and h:commandLink. Is it normal for
navigation away from one of these pages to fail? My button links to an
action on a session-scoped managed bean. The action works fine from
commandLinks in other pages, even after an error occurs (in cases where
the back button gets me back to a non-error page)
[1] http://wiki.apache.org/myfaces/Handling_Server_Errors
Below are my relevant source.
Regards,
Jeff Bischoff
Kenneth L. Kurz & Associates, Inc.
Section of Web.xml:
<error-page>
<error-code>404</error-code>
<location>/pages/common/UnknownErrorPage.faces</location>
</error-page>
Entire UnknownErrorPage.faces:
<%@ page contentType="text/html; charset=iso-8859-1" language="java" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<f:subview id="Error">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>CSW System - Error Page</title>
<link rel="stylesheet" type="text/css"
href="<%=request.getContextPath()%>/pages/css/csw.css" />
<jsp:include page="/pages/common/jsRollover.jsp" />
<jsp:include page="/pages/common/jsSubmitEnter.jsp" />
</head>
<body>
<h:form>
<f:attribute name="ErrorMessagesCount"
value="#{errorMessages.errorCount}" />
<t:div id="unknownErrorPageBox" forceId="true">
<f:verbatim>
<table width="800"><tr><td align="center">
<table id="Error_Message_Table" border="0" cellpadding="0"
cellspacing="0">
<tr height="28" valign="bottom">
<td width="50"></f:verbatim><h:outputText
value="#{errorMessages.errorHeader}" styleClass="styleFont
styleErrorHeader"/><f:verbatim></td>
<td>
<c:forEach var="message"
items="${errorMessages.errorList}">
<span class="styleFont
styleErrorMessage">
<c:out
value="${message}"/>
</span><br>
</c:forEach>
</td>
</tr>
<tr height="40"/>
</table>
</td></tr><tr><td align="center">
<table width="100%" id="Error_Message_Button" border="0"
cellpadding="0" cellspacing="0">
<tr><td align="center"></f:verbatim><h:commandButton
action="#{tabNavigation.logout}" value="Logout" styleClass="styleFont
styleErrorHeader"/><f:verbatim></td></tr>
</table>
</td></tr></table>
</f:verbatim>
</t:div>
<h:commandLink action="#{tabNavigation.logout}"><h:outputText
value="Logout"/></h:commandLink>
</h:form>
</body>
</html>
</f:subview>