我使用xmlns:jsp="http://java.sun.com/jsp/page“在我的xhtml faces页面中声明了jsp名称空间。
<?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"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
xmlns:jsp="http://java.sun.com/jsp/page"
xml:lang="en" lang="en">但是,jsp:include指令并没有被处理,只是被呈现了。我的IDE (Netbeans)告诉我,它找不到此名称空间的库。我正在使用maven和下面的pom.xml文件。我将另一个应用程序部署到同一个容器中,它使用类似的结构,但没有使用maven。我永远也想不出我需要包含什么库才能使任何jsp:指令工作。
">http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0
<groupId>com.j2anywhere.demo</groupId>
<artifactId>JSFDebug</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>JSFDebug</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>2.1.7</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
<version>1.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jstl-impl</artifactId>
<version>1.2</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<netbeans.hint.deploy.server>Tomcat</netbeans.hint.deploy.server>
</properties>
提前感谢
发布于 2012-03-10 03:03:00
您使用的是Facelets,它基本上是JSP的后继者。它是两种完全不同的视图技术。一个是基于XML的,另一个是基于Servlet的。不能在Facelets中使用JSP标记,也不能在JSP中使用Facelets标记。
您需要使用Facelets自己的。
<ui:include src="/WEB-INF/includes/foo.xhtml" />在使用Facelets进行开发时,请完全忘记JSP。
另请参阅:
https://stackoverflow.com/questions/9639513
复制相似问题