我正在使用JSF 2.0,Maven 2,Springframework 3和Glassfish 3.我正在尝试使用FixedThemeResolver
,但我无法将标记插入到facelet中。我写了这样一个页面:
<?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:ui="http://java.sun.com/jsf/facelets"
xmlns:em="http://java.sun.com/jsf/composite/emcomp"
xmlns:st="http://www.springframework.org/tags">
<head>
<link href="${facesContext.externalContext.requestContextPath}/files/basic.css" rel="stylesheet" type="text/css" media="all"/>
<title><ui:insert name="title">Default Title</ui:insert></title>
</head>
<body>
<h1><ui:insert name="heading">Default heading</ui:insert></h1>
<p><st:theme code='css' /></p>
<em:komponenta textik="Experimental component"/>
<ui:insert name="content" />
<hr/>
<i>${appVersion}</i>
<ui:include src="/WEB-INF/templates/footer.xhtml" />
</body>
</html>
它不起作用。在Eclipse中,我收到一个警告,即命名空间http://www.springframework.org/tags
没有任何标记库。在Web浏览器中,我得到警告:此页面调用以前缀st声明的XML名称空间http://www.springframework.org/tags,但该名称空间不存在taglibrary。
我已经在我的pom.xml中声明了对Spring MVC的依赖:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
它应该是,但似乎不是。非常感谢任何提示。
答案 0 :(得分:2)
我自己解决了这个问题。 BalusC是对的。 Spring标签我只能用于JSP。 Facelet是别的东西(令人遗憾的是新的)。它的工作方式不同因此,我不能在facelet中使用JSP标记。在这个简单的案例中,Nevertheles我在几分钟内编写了自己的自定义标签。我只需要从存储在类路径中的文本文件中获取值并将其放入传出的HTML中。
正确的答案是:那不是错误,这是一个功能。您不能在facelet中使用JSP标记。
答案 1 :(得分:1)
你的pom.xml是否列出了spring maven资源库?
id是“spring-maven-release”,名称是“Spring Maven Release Repository”,url是“http://maven.springframework.org/release”