开发者

Using JSP 2.0 tags in Facelets

Is someone using Facelets 开发者_如何学编程with JSP 2.0 tags? How to add tag library to xhtml page? In JSP I used:

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

How can I do the same in facelets with JSP 2.0 tags?


In Facelet XHTML you would add a taglib in the following way:

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

Some JSP tags are ported to facelets, using the facelets tag library descriptors.

So if you want to define facelets tags, add the appropriate descriptors.


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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜