Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSF tags are not rendered in error page

783372May 22 2013 — edited May 28 2013
I have configured error page for HTTP 404 error in web.xml like this
<error-page>
<error-code>404</error-code>
<location>/Common/error.jspx</location>
</error-page>

Faces Servlet is configured as follows
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>

My error page (error.jspx) looks like this

<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html" xmlns:trh="http://myfaces.apache.org/trinidad/html"
xmlns:tr="http://myfaces.apache.org/trinidad" xmlns:c="http://java.sun.com/jsp/jstl/core">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<html>
<head>
<title>Error Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body id="b1">

<h4 style="color:red">An Error Occured. Please click Back button or Signout.</h4>
<input type="button" value="Back" onclick="history.back()"/>
<tr:commandButton id="cb1" text="SIGN OUT" action="exit" actionListener="#{Login.LogOut}"/>
</body>
</html>
</jsp:root>

When I deploy application and run into 404 error, page displays error message with only Back button. I don't see SingOut button. I have checked url and it follows /faces/* pattern. Still to double check, I made a change and configured servlet mapping in web.xml as
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
<url-pattern>*.jspx</url-pattern>
</servlet-mapping>

Still commandButton is not rendered. I understand that my error page don't have access to FacesContext or not going through Faces Servlet. I know this is a small issue, but couldn't figure out what can be done. I have also tried using .xhtml and .jsf as per googled suggestion. But no luck
I have tried different solutions to my problem and googled for solutions. But I couldn't get it resolved.

So can you please provide any suggestions...

Edited by: user1818355 on May 22, 2013 2:29 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 25 2013
Added on May 22 2013
6 comments
516 views