找不到http://java.sun.com/jsf/facelets的标签库描述符 [英] Can not find the tag library descriptor for http://java.sun.com/jsf/facelets

查看:127
本文介绍了找不到http://java.sun.com/jsf/facelets的标签库描述符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个JSP,

<%@taglib uri="http://java.sun.com/jsf/facelets" prefix="ui" %>

但是错误

绝对uri: http://java.sun.com/jsf/facelets 不能可以在web.xml或与此应用程序一起部署的jar文件中解决

The absolute uri: http://java.sun.com/jsf/facelets cannot be resolved in either web.xml or the jar files deployed with this application

我有库facelets-lib.jarjsf-facelets-1.1.10.jar,我认为它们是Facelets,但是它们不包含JSP taglib描述符.

I have libraries facelets-lib.jar and jsf-facelets-1.1.10.jar, which I suppose is Facelets, but they do not contain JSP taglib descriptors.

哪个文件正确?

推荐答案

Facelets旨在完全替换 JSP.但是,您正在尝试将其声明为JSP taglib.这是永远行不通的.两者都是独特的视图技术. Facelets是一种基于XML的视图技术,旨在替代JSP.在2009年12月发布的Java EE 6中,它已取代JSP成为JSF的标准视图技术,此后不推荐使用JSP.

Facelets is intented to replace JSP altogether. But yet you're attempting to declare it as a JSP taglib. This is never going to work. Both are distinct view technologies. Facelets is a XML based view technology which is designed to be a successor of JSP. In Java EE 6 which was released december 2009 it has already replaced JSP as standard view technology for JSF and JSP has since then been deprecated.

您需要将文件扩展名从.jsp重命名为.xhtml,并将所有JSP taglib声明替换为XML名称空间声明,并删除所有<jsp:xxx>标记和所有<% %>脚本.

You need to rename file extension from .jsp to .xhtml and replace all JSP taglib declarations by XML namespace declarations and remove all <jsp:xxx> tags and all <% %> scriptlets.

例如,以下基本JSP模板page.jsp

So, for example the following basic JSP template page.jsp

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE html>
<f:view>
    <html lang="en">
        <head>
            <title>JSP page</title>
        </head>
        <body>
            <h:outputText value="JSF components here." />
        </body>
    </html>
</f:view>

必须重写为page.xhtml

<!DOCTYPE html>
<html lang="en"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets">
    <head>
        <title>Facelet page</title>
    </head>
    <body>
        <h:outputText value="JSF components here." />
    </body>  
</html>

最后,提到的JAR文件是Facelets 1.x JAR,而Facelets 2.x自2009年以来就已经作为

Finally, the mentioned JAR files are Facelets 1.x JARs while Facelets 2.x is already been out since 2009 as part of a JSF 2.x implementation. If you can, I'd strongly recommend to just skip Facelets 1.x and continue with Facelets 2.x.

  • Facelets Developer Documentation (for Facelets 1.x)
  • Java EE 6 tutorial - Facelets (for Facelets 2.x)
  • JSF 2.0 tutorial with Eclipse and Glassfish (to start from zero)
  • Migrating from JSF 1.2 to JSF 2.0

这篇关于找不到http://java.sun.com/jsf/facelets的标签库描述符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆