简体   繁体   English

在Facelets中使用JSP 2.0标记

[英]Using JSP 2.0 tags in Facelets

Is someone using Facelets with JSP 2.0 tags? 是否有人将Facelets与JSP 2.0标签一起使用? How to add tag library to xhtml page? 如何将标签库添加到xhtml页面? In JSP I used: 在JSP中,我使用了:

<% taglib prefix="example" tagdir="/WEB-INF/tags/my" %> 
and : <example:sample/>

How can I do the same in facelets with JSP 2.0 tags? 如何在带有JSP 2.0标签的facelets中执行相同操作?

In Facelet XHTML you would add a taglib in the following way: 在Facelet XHTML中,您可以通过以下方式添加taglib:

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jstl/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

Facelets and JSP are mutually exlusive - they are two different view technologies. Facelets和JSP是互斥的-它们是两种不同的视图技术。

Some JSP tags are ported to facelets, using the facelets tag library descriptors. 使用facelets标签库描述符将某些JSP标签移植到facelets。

So if you want to define facelets tags, add the appropriate descriptors. 因此,如果要定义facelets标签,请添加适当的描述符。

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

That's "http://java.sun.com/ jsp /jstl/core" or it won't work. 那是“ http://java.sun.com/ jsp / jstl / core”,否则将无法使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM