0 Replies Latest reply on Apr 19, 2012 9:25 AM by Thomas Buckley

    Handling JSF error messages at Apply Request Value Phase

    Thomas Buckley Newbie

      Hi

       

      I'm using JSF 2.1.2 with Richfaces 4.

       

      I'm trying to find a solution for the following problem.

       

      - A user installs the 'Tamper Data' plugin for firefox (Used to intercept and modify http requests values when submitting forms).

      - The user visits a page on my application and fills out some input fields. One of the input fields is a rich:calendar component, they select a date from the calendar popup and the input field beside it is populated.

      - They open the 'Tamper Data' plugin and select 'Start Tamper'.

      - They submit the form (normal synchronous request).

      - The use the Tamper Data plugin to add invalid charchters to some of the calendar components request values.

      - The request is sent with tampered data to Bean.

      - The page is returned with the following error messages displayed:

       

      java.lang.NumberFormatException: For input string: "2012dsafsf"
      java.lang.NumberFormatException: For input string: "2012sdfsdf"
      

       

      For the page the request is performed on, I have a <f:messages /> component

       

      I believe this is happening due to the component values not been converted to the appropriate objects at the 'Apply Request Values' phase (Due to their values been tampered with).

       

      I want to send users to a generic error page when these type of errors occur.

       

      Options I have tried without any success include:

      1:

      <error-page>
        <exception-type>java.lang.NumberFormatException</exception-type>
        <location>/error.xhtml</location>
      </error-page>
      
      

       

      2:

      I created a custom converter on the calendar component but also is of no use.

       

      Has anyone created something similar to handle JSF/Richfaces error messages at this 'Apply Request Values' phase?

       

      Thanks