I got a bit stuck while taking my first baby steps with Custom Components in JavaServer Faces 2.2 (Jakarta Server Faces).
My problem is, how can a renderer class know, if a ConverterException was thrown? I need this check in my renderer, because I want the renderer to apply a 'invalid' class to the HTML input tag. The converter is used only for this Custom Component.
Here are some things I looked into, but I am not confident any of these this is the right approach.
The method is
isValidationFailed
fromFacesContext
does not apply to conversion errors. So this is a dead end.I could create my own class from
UIInput
with a attribute 'invalid' and set this in thegetAsObject
method of theConverter
class in case anything breaks. The renderer then checks the property of the component class.I could iterate over
getMessages
fromFacesContext
and look for a message from the converter.I can use the
h:message
approach and do some JavaScript DOM manipulation on the client side. If I find a h:message with a specific class, I apply another class to the input tag.Skip the renderer and do the rendering in the component class. Not sure if this gives me anything though.
Thanks in advance!