简体   繁体   中英

no tag was defined for name: viewAction

I have just incorporated JSF 2.2.2 in my existing project and I want to use f:viewAction but I am getting the following error.

<f:viewAction> Tag Library supports namespace: http://java.sun.com/jsf/core, \
but no tag was defined for name: viewAction

Here is my code:

<f:metadata>
    <f:viewAction action="#{testBean.doIT}"/>
</f:metadata>

Here is my controller:

@Named("testBean")
@Scope(ScopeType.VIEW)
public class TestBeanimplements Serializable {
public void doIT(){
  System.out.println("Test Working !!!!!!!!");
    }
}

Here is my maven configuration for JSF:

<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>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>javax.servlet.jsp</groupId>
    <artifactId>javax.servlet.jsp-api</artifactId>
    <version>2.2.1</version>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>javax.el</groupId>
    <artifactId>javax.el-api</artifactId>
    <version>2.2.1</version>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>javax.servlet.jsp.jstl</groupId>
    <artifactId>jstl-api</artifactId>
    <version>1.2</version>
    <scope>provided</scope>
</dependency>

Could anyone please explain to me why I am getting this error ?

您必须使用新的命名空间: xmlns:f="http://xmlns.jcp.org/jsf/core"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM