3 Replies Latest reply on Jun 24, 2009 3:51 PM by ambrish_kumar

    Displaying an Error page whenever an Exception occurs.

    ambrish_kumar

      Hi Everyone,


      I want to display an error page says, Error.xhtml, whenever an exception occurs in my application.


      Is it possible in SEAM ?


      I have done this successfully using Struts 2 framework.


      Any help would be appreciated.



      Thanks


      Ambrish

        • 1. Re: Displaying an Error page whenever an Exception occurs.

          Use below tags in pages.xml



                <exception>
                    <redirect view-id="/pages/Error.xhtml">
                            <message severity="ERROR">Internal rror.</message>
                          </redirect>
               </exception>



          • 2. Re: Displaying an Error page whenever an Exception occurs.
            ambrish_kumar

            Hi Tekchand,


            Thanks for your quick reply.


            I have already done this in pages.xml file.


            But whenever Method not found exception occurs it displays the Jboss SEAM Debug page.


            Here is the exception,




            Exception during request processing:
            Caused by javax.servlet.ServletException with message: "#{manageUser.addUser}: /user/manageUser.xhtml @30,76 action="#{manageUser.addUser}": Method not found: manageUserAction:a001h-anbz4q-fwc2sa93-1-fwc2wh9z-1x.addUser()"



            I have not defined the addUser() method in my Managed bean manageuserAction.
            and the location of my error.xhtml page is view/error.xhtml it is not inside any folder.
            But my manageUser.xhtml page is inside view/user/manageUser.xhtml.


            I don't think location of error.xhtml page is creating any problem here.


            Thanks


            Ambrish

            • 3. Re: Displaying an Error page whenever an Exception occurs.
              ambrish_kumar

              Hi Everyone ,


              My problem is solved.


              I have used ,




              <exception class="javax.faces.FacesException">
                        <redirect view-id="/error.xhtml">
                             <message>
                                  Unexpected error, please try again
                             </message>
                        </redirect>
              </exception>





              If anybody knows some other solution then please let me know.


              Thanks


              Ambrish