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:
..../user/detail.jsf?id=123
Now, what should happen if user with ID 123 does not exists? I think that natural reaction would be 404 standard error. Exactly the same as is outputed when you make some typo in URL (like /user/dtail.jsf). So the question is: is there such method?
Or maybe is this reaction (404) appropriate?
Thanks.
Just attach a validator to the id view parameter and if validation fails, set error code 404 on the response.
e.g.
Consider this simple Facelet:
And the following backing bean: