本文介绍了将JSTL与Facelets集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑在同一个Web项目中使用Facelets和JSTL.

I am considering using Facelets and JSTL in the same web project.

在整合这些功能时有什么问题吗?

Are there any issues in integrating these ?

推荐答案

Facelets已克隆 一组有限的好旧" JSTL标签,并包含在Facelets库中.在此处中都对它们进行了描述.换句话说:Facelets并不支持所有的JSTL标签/功能.

Facelets has cloned a limited set of "good old" JSTL tags and included in the Facelets library. They are all described here. In other words: not all JSTL tags/functions are supported in Facelets.

如果您想使用任何原始的JSTL标记,但Facelets无法使用它,那么您将前往另一个角落寻求解决方案. JSTL sql xml 标签库不属于视图,而是属于模型/业务逻辑. JSTL fmt 标签库已被JSF的<f:loadBundle><f:formatXXX>标记覆盖. JSTL 功能标签库使用自定义EL功能可以很好地完成.我已经在.

If there's any original JSTL tag which you would like to use, but isn't made available by Facelets, then you'll head in another corner for the solution. The jobs which can be done by the JSTL sql and xml taglibs doesn't belong in the view, but rather in the model/business logic. The JSTL fmt taglib is already covered by JSF's <f:loadBundle> and the <f:formatXXX> tags. The JSTL functions taglib can be as good done with custom EL functions. I've posted an example in this answer.

JSF和原始JSTL库的问题在于它们没有像您期望的那样同步运行.更重要的是,JSTL首先从上到下运行页面,然后将生成的输出移交给JSF进行进一步处理.当使用例如<c:forEach>时,这可能会导致意外结果.

The problem with JSF and the original JSTL library is that they doesn't run in sync as you would expect from the coding. It's more so that JSTL runs the page from top to bottom first and then hands the generated output over to JSF for further processing. This may lead to unexpected results when using for example <c:forEach>.

这篇关于将JSTL与Facelets集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 03:26