How to “throw” JSF2 404 error?

前端 未结 3 1907
一向
一向 2020-12-16 16:45

Let\'s say that I have an application which manages users. You can add new user, delete them, edit detail etc. Each user has na ID and has detail page on URL like this:

3条回答
  •  温柔的废话
    2020-12-16 16:47

    As mentioned, you can get the context from within a managed bean. I tried the validator approach, but for me it wasn't applicable since I was using two parameters to initialize my bean, and I do want to throw a 404. For me .setResponseStatus didn't throw the 404-page. Just gave a non-informative browser page. So I used the responseSendError instead.

提交回复
热议问题