如何在dataTable中传递方法中的值

时间:2012-08-06 19:43:07

标签: jsf jsf-2 datatable variable-assignment

我拥有的是数据表,我有方法返回我的列表。

我的语法是

 <h:dataTable id="imageList3" 
  value="#{PersonalInformationDataBean.loadReviewReportDataByIdNewFormat()}"
  var="reviewMyList" width="80%" border="1">

我想要做的是在方法#{patentMyList.patentId}中传递变量名loadReviewReportDataByIdNewFormat()名称。但是我无法这样做....

知道如何完成这项工作吗?

我知道如果我有commandButton,我会使用<f:setPropertyActionListener>

注意:

如果我使用,它的工作

 <h:dataTable id="imageList3" 
  value="#{PersonalInformationDataBean.loadReviewReportDataByIdNewFormat(1)}"
  var="reviewMyList" width="80%" border="1">

然而

 <h:dataTable id="imageList3" 
  value="#{PersonalInformationDataBean.loadReviewReportDataByIdNewFormat(#{patentMyList.patentId})}"
  var="reviewMyList" width="80%" border="1">

patentId的数据类型为长。

1 个答案:

答案 0 :(得分:0)

语法#{}激活ExpressionLanguage评估,因此您可以执行以下操作:

#{yourBean.loadReviewReportDataByIdNewFormat(patentMyList.patentId)}

你可能期望它像PHP和其他基于模板的语言一样$some_variable,但它不是:一旦激活,你可以使用普通的变量名和操作数。

查看EL info page了解详情。

相关问题