5

我刚刚将 JSF 2.2.2 合并到我现有的项目中,我想使用f:viewAction但我收到以下错误。

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

这是我的代码:

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

这是我的控制器:

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

这是我对 JSF 的 Maven 配置:

<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>

谁能向我解释为什么我会收到这个错误?

4

1 回答 1

9

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

于 2013-08-21T08:38:29.623 回答