我剛剛在我現有的項目中加入了JSF 2.2.2,並且我想使用f:viewAction
但我收到以下錯誤。沒有標籤被定義爲name: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>
任何人都可以請解釋對我來說,爲什麼我得到這個錯誤?
你應該接受的答案,如果它的工作對你(對我來說,雖然不工作) –
也請添加您的服務器 –