| Author |
JSF portlet (jsr 168) error handling - why oh why...
|
|
|
| Hey everybody
Why is there no documentation on jsf portlet error handling?
You can't use error-page in web.xml and everybody always write about how you can easily navigate to an error page from your action method.
But what if the exception occurs outside of an action method?
For instance when a h:outputtext fetches its value in a faces managed bean - what if the specific getter throws an exception.
Or when a faces managed bean is first constructed before the page is actually loaded.
How do you all handle these situations?
/Chr
| |
|
| You can display a message in this case using the <h:message> tag. Here's a simple example:
<h:outputText id="outputText" value="#{managedBean.value}"/> <h:message id="errorMessage" for="outputText"/>
| |
|
| Yes that is true, but what if want to go to an error page instead?
| |
| Jerome Curlier 2006-05-10, 7:15 pm |
| what about using the JSP directive:
<%@page language="java" errorPage="error.jsp"%>
JC
<christian.landbo.frederiksen@ementor.dk> wrote in message
news:1590866879.1147271053170.JavaMail.wassrvr@ltsgwas007.sby.ibm.com...
> Yes that is true, but what if want to go to an error page instead?
| |
|
| errorPage="error.jsp"
Yep I'm going that way now, but I can't make it work. I keep getting a PortletException (Assertion Failed) error after error.jsp:init.
I tried to make error.jsp a standard jsp and not a Faces jsp - then it worked??
I don't know why the error.jsp cannot be a Faces jsp but I would like it to be so I can use Messages etc.
Has anybody has any luck using a Faces error page and if so can you get to the exception in the backing beans so you can log it and present as a Message.
/Chr
| |
| riaanm 2006-05-12, 7:16 am |
| The JSF assertion error usually occurs (in my experience) when a certain JSF tag is not preceded by another required JSF tag. Like placing a h:commandButton not inside a h:form or f:view.
It is a poor implementation by not letting you know what is required by the failing JSF tag.
------------------------
Riaan Minne
IBM South Africa
|
|
|
|