I am trying to show an generic error message page when a user tampers with POST data in a richfaces calendar. (Using tamper data firefox plugin).
I select a normal date, turn on the tamper and adjust the date value to contain string values. It returns to the page displaying the following error messages:
java.lang.NumberFormatException: For input string: "2012dsafsf"
java.lang.NumberFormatException: For input string: "2012sdfsdf"
I'm using <h:messages />
to display messages.
I have added the following to my web.xml but it is not redirecting to this page.
<error-page>
<exception-type>java.lang.NumberFormatException</exception-type>
<location>/error.xhtml</location>
</error-page>
Any ideas where I'm going wrong?
What I essentially need is a generic class/phase listener/converter/whatever.. to intercept and handle certain types of exceptions that are caught by JSF. (Not unhandled exceptions).
Thanks
The easiest way to fix it is to add a validator to the field. With the validator it is possible to add a specific message for this error.
Some information on Validation & conversion: http://www.ibm.com/developerworks/java/library/j-jsf3/
The error documents are used for HTTP status codes (eg 404/500)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.