1
votes

i am Using JSF 2.2, Jboss 7. While running its just keep saying " Tag Library supports namespace: http://java.sun.com/jsf/html, but no tag was defined for name: inputFile" this error.. Anyone help me to solve this problem..

Below is that xhtml file. the error is on "" this line.

index.xhtml:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        Hello from Facelets

        <h:form  enctype="multipart/form-data">
            <h:inputFile value="#{demoBean.file1}" /><br/>

            <h:inputFile value="#{demoBean.file2}" /><br/>
            <h:commandButton value="Upload" action="#{demoBean.upload()}"/>
        </h:form>
    </h:body>
</html>

Dependencies-pom.xml:

<dependencies>
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>2.2.2</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>2.2.2</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.0.1</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>org.primefaces</groupId>
            <artifactId>primefaces</artifactId>
            <version>3.0</version>
        </dependency>
        <dependency>
            <groupId>org.primefaces.themes</groupId>
            <artifactId>bootstrap</artifactId>
            <version>1.0.9</version>
        </dependency>
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.3</version>
        </dependency>
    </dependencies>

I am in maven and all libraries are mentioned in pom file. besides, except "" tag all other tags are working and i searched but still this not solved yet. know that i simple mistake. i could not figure out, new to JSF. Many of experience this problem, give me the solution.

1
if i use this xmlns.jcp.org/jsf/html namespace i am getting "DemoBean does not have the property 'upload'. but i given the upload() method in DemoBean.javaJambu
Thanks balusc. as you said, i will know that clearly and do that.Jambu
Hi.. i cleared issues. now i am able to upload files. thank u so much..Jambu
OK, I reposted the comments as an answer.BalusC

1 Answers

1
votes

That will happen if you're actually not using JSF 2.2.

JBoss 7 provides by default JSF 2.1 out the box in flavor of Mojarra 2.1.x. Your pom suggests that you manually upgraded it to Mojarra 2.2.2, which is in turn impossible as it's known that from Mojarra 2.2.x only version 2.2.8 and newer are compatible with JBoss 7 (older versions throw Weld ContextNotActiveException during deployment).

Upgrade it as per instructions in Upgrade JSF / Mojarra in JBoss AS / EAP / WildFly and it should work. And, take the opportunity to migrate the JSF 2.0/2.1 XML namespace domain of java.sun.com to JSF 2.2 XML namespace domain of xmlns.jcp.org. See also Which XML namespace to use with JSF 2.2.