When exactly do you call getInputFor()? During rendering process?
(encodeBegin()/encondEnd())
according to specs, findComponent will not work properly if your Label
is not yet attached to it's parent NamingContainer. (form in you case),
so i would suggest to check for getInputFor only in renderer.

En l'instant précis du 12/21/06 11:44, Josué Alcalde González
s'exprimait dans toute sa noblesse:
> I am extending HtmlOutputLabel adding a "*" when its for component is
> required.
>
> I am almost successful but I am having a problem.
> The "*" is not rendered the first time the page is rendered.
>
> The problem, is that findComponent does not find the "for" component
> using findComponent the first time:
>
> [...]
> public EditableValueHolder getInputFor(){
>       UIComponent uiFor = findComponent(getFor());
>       if (uiFor == null || !(uiFor instanceof EditableValueHolder))
>               return null;
>       return (EditableValueHolder) uiFor;
> }
>
> [...]
> EditableValueHolder uiFor = uiLabel.getInputFor();
> if (uiFor == null || !((EditableValueHolder) uiFor).isRequired())
>       return;
>
>
> [...]
>
> <f:view>
>       <h:form>
>               <csa:outputLabel id="ol" value="Hello world" for="it""/>
>               <t:inputText id="it" required="true" />
>               <t:commandButton id="cb" value="Button"/>
>       </h:form>
>       <t:messages />
> </f:view>
>
> Why it is not find 
>
>
>   

Reply via email to