开发者

How can I get the "http://www.springframework.org/tags" taglibrary visible?

I'm using JSF 2.0, Maven 2, Springframework 3 and Glassfish 3. I'm trying to use the FixedThemeResolver, but I cannot insert the tag into the facelet. I have written a page like this:

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

It does not work. In Eclipse I get a warning, that there is not any tag library for the namespace http://www.springframework.org/tags. In the web browser I get Warning: This page calls for XML namespace http://www.springframework.org/tags declared with prefix st but no taglibrary exists for that namespace.

I have declared dependency on Spring MVC in my 开发者_如何学编程pom.xml:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc</artifactId>
    <version>3.0.5.RELEASE</version>
</dependency>

It should be enought, but it seems it isn't. Thanks a lot for any hint.


I've solved this problem by myself. BalusC is right. Spring tags can I use only with JSP yet. Facelet is something else (and new regrettably). It works differently. Thus I cannot use JSP tags within a facelet. Nevertheles in this simple case I've written my own custom tag in few minutes. Only I need is to pick up the value from textual file stored in classpath and put it into the outgoing HTML.

Also the right answer is: That's not error, that's a feature. You cannot use JSP tags within a facelet.


Does your pom.xml has spring maven repository listed?

id is "spring-maven-release", name is "Spring Maven Release Repository" and url is "http://maven.springframework.org/release"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜