3 Replies Latest reply on Jul 14, 2008 9:59 AM by accless

    Customized message on 404-errorpage

    toby.tobias.hill.gmail.com

      In our system we like to signal 404 when a user is trying to find an entity (by tinkering with the url for instance) which we don't have in our database. We like to customize a message for that error-page like: Foo does not exist in our system. It is also of importance that the page has the 404-header.


      The bean doing the search is under conversation scope (not long-running).


      The message is lost in this process.
      Isn't this possible to do?


      /Tobias


      Btw. I don't really want to work around this by posting the customize message to session scope to preserve it long enough ...

        • 1. Re: Customized message on 404-errorpage
          dan.j.allen

          I don't think the conversation is propagated to the error page (I could be wrong). Your best bet is to throw an exception that is annotated with @HttpError. There is an example of this in chapter 3 of Seam in Action.

          • 2. Re: Customized message on 404-errorpage
            toby.tobias.hill.gmail.com

            Hi Dan, and thanks for answering,


            Trowing an HttpError-annotated exception is exactly what we do ... but the message that we stuck into facesMessages just before throwing does not live to see the 404-page.


            Any clever workarounds that comes into mind, or is signalling via the session-scope what's needed?


            Best regards
            Tobias


            • 3. Re: Customized message on 404-errorpage
              accless

              As fas as i understand the SEAM ref doc (2.1.0), the conversation is propagated to the error page!
              I am referring to chapter: 5.3.4




              ... You can also access the handled exception instance through EL, Seam places it in the conversation context, e.g. to access the message of the exception:...


              The ref describes an example how to access the message of the thrown exception within/from pages.xml. As SEAM places the message in the conversation, i would conclude that SEAM does NOT destroy it!


              Therefore, Tobias could put any Object in the Conversation context and reference it in the error page. Or just put your customized message in the exception itself!



              Greetings


              PS: pls correct me if i am wrong!