如何在JSF中创建变量以使用JSP标记 [英] how can I create variable in JSF to use thro' JSP tag

查看:78
本文介绍了如何在JSF中创建变量以使用JSP标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用战斧dataList,在其中使用

I am using tomahawk dataList, where I use

rowIndexVar="rowIndex"

在我一直使用逐字记录的dataList中, 我需要通过JSP EL $ {rowIndex}来获取rowIndex. 我该怎么做到.

Inside the dataList I have been using verbatim, where I need to retreive the rowIndex thro' JSP EL ${rowIndex}. How can I achieve it.

推荐答案

<f:verbatim>中的所有内容都将被视为模板文本.如果要评估EL表达式,只需将其放在<f:verbatim>之外.

Anything in <f:verbatim> will be treated as template text. If you want to evaluate EL expressions, simply put it outside <f:verbatim>.

<f:verbatim><p><h:outputText value="#{rowIndex}" /></p></f:verbatim>

但是愿意

<f:verbatim><p></f:verbatim>
    <h:outputText value="#{rowIndex}" />
<f:verbatim></p></f:verbatim>

是的,这很丑陋,但是,如果您使用的是JSF 1.2或更高版本,则无论如何都可以省略<f:verbatim>.

True, it's ugly, but if you're using JSF 1.2 or newer, you can omit the <f:verbatim> anyway.

<p><h:outputText value="#{rowIndex}" /></p>

或者,如果您使用的是带有Facelets的JSF 2.0,甚至可以在模板文本中使用统一的EL:

Or if you're on JSF 2.0 with Facelets, you can even use unified EL in template text:

<p>#{rowIndex}</p>

这篇关于如何在JSF中创建变量以使用JSP标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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