I have this local URL: http://localhost:8084/Name/faces/Blah.xhtml?flkatid=AAA
and this is a segment from a facelet, that checks the parameter "flkatid" and assigns it to the bean:
<f:metadata>
<f:viewParam name="flkatid"
id="flkatid"
value="#{floKatBean.flkatid}"
required="true"
requiredMessage="URL incomplete"
validator="#{floKatBean.validateFlKatId}"
validatorMessage="URL incomplete or invalid"
>
</f:viewParam>
<f:event type="preRenderView" listener="#{floKatBean.init}"/>
<f:event type="preRenderView" listener="#{floBean.holFloListe}"/>
</f:metadata>
floKatBean.flkatid is an integer, thus the URL is invalid. A page is displayed, that tells this:
flkatid: 'AAA' must be a number consisting of one or more digits. flkatid: 'AAA' must be a number between -2147483648 and 2147483647 Example: 9346
JSF checks the parameter itself, because it knows that the bean element is an integer. The custom validator is only called if the parameter is an integer.
Is it possible to get the server to return a HTTP error code, e.g. 403 (forbidden) without leaving the "standard JSF world" (or switch to RichFaces, MyFaces, SmileyFaces or whatever) ? I can't find anything in f:viewParam to "fail" the page. Maybe elsewhere?