JSF don't find component in view root with the form id

Posted by kenzokujpn on Stack Overflow See other posts from Stack Overflow or by kenzokujpn
Published on 2010-04-05T20:02:50Z Indexed on 2010/04/05 20:33 UTC
Read the original article Hit count: 272

Filed under:
|
|

I have a t:inputFileUpload inside the form, in the html of the display page the id of this component is form:inputFile but when I tried to get the component from the view root using "form:inputFile" the return is null, but when the "form:" is removed the return is the component. The component don't set the value in my managed bean, someone have this problem?

EDIT:

<h:form id="form" enctype="multipart/form-data">
<t:inputFileUpload id="inputFile" size="40" value="#{managedBean.inputFile}"/>
</h:form>

In the managed bean:

    private UploadedFile inputFile;

with the gets and sets provided by Eclipse.

//This method scans the view root and returns the component with the id passed as parameter
findComponentInRoot("form:inputFile");

This returns null, but when I use:

   //This method scans the view root and returns the component with the id passed as parameter
    findComponentInRoot("inputFile");

The return is the component I'm looking for, but when I use the View Source in Internet Explorer the id of this component is "form:inputFile".

I don't know if this is related, but the component don't set the value in my managed bean and it's strange the fact that the id of the component is different from the HTML source. I'm using JSF 1.2 Mojarra. Someone else has this problem? Or know why this happens?

© Stack Overflow or respective owner

Related posts about jsf

Related posts about java