The error "/resources/components/hostForm.xhtml @25,84 value="#{cc.attrs.host.hostName}": Target Unreachable, 'host' returned null"
occurs after I added
<f:validateLength minimum="1" maximum="200"/>
to an inputText field in a custom tag. Without the validation everything works well.
<!-- INTERFACE -->
<composite:interface>
<composite:attribute name="host" />
<composite:attribute name="prefix" />
</composite:interface>
<!-- IMPLEMENTATION -->
<composite:implementation>
<h:panelGrid columns="3" columnClasses="titleCell">
<h:outputLabel for="#{cc.attrs.prefix}hostName" value="Host Name" />
<h:inputText id="#{cc.attrs.prefix}hostName" value="#{cc.attrs.host.hostName}">
<f:validateLength minimum="1" maximum="200"/>
<rich:validator />
</h:inputText>
<rich:message for="#{cc.attrs.prefix}hostName" />
</h:panelGrid>
</composite:implementation>
The field is declared as
@Named
@Produces
private Host newHost;
The custom tag invocation:
<my:hostForm prefix="c" host="#{newHost}"/>
What do I need to change to get this work with validation?
EDIT:
The Bean already has the @ConversationScoped
annotation.
Adding a @ConversationScoped
annotation to the fields leads to this error:
hostForm.xhtml @20,74 value="#{cc.attrs.host.id}": org.jboss.weld.exceptions.IllegalProductException: WELD-000052 Cannot return null from a non-dependent producer method: [field] @Named @ConversationScoped @Produces