在渲染富数据表时将参数传递给JSF支持bean

时间:2013-07-25 05:28:11

标签: tomcat6 jsf-1.2

我正在使用JSF 1.2,Servlets 2.5,Tomcat“6”和richfaces 3.我使用rich:dataTable在页面上的oracle中显示数据。现在我需要根据其id在表行的特定列中显示一些自定义信息。我尝试将参数发送到我的支持bean,如下所示(我知道tomcat 7和el 2.2 jar,servlets 3会解决这个问题,但我不能从我现在的设置中移开,所以我知道我的替代方案。谢谢)

    <rich:dataTable rendered="true" value="#{studentBean.studentList}" var="dataList">
      ...
   <rich:column sortable="true">
 <f:facet name="header">
  <h:outputText value="Details"/>
     </f:facet>
<h:outputText value="#{studentBean.studentCategory(dataList.id)}"/>
   </rich:column>
      ...
    </rich:dataTable>

我的支持bean是

public String studentCategory(Long id)
 {
        String categoryString;
        //...process table rows with id and return a 
        //...concatenated string
   return categoryString;
 }

我收到以下错误

 The function studentCategory must be used with a prefix when a default namespace is   
 not specified

请求帮助。

1 个答案:

答案 0 :(得分:1)

JSF 1.2不支持对方法传递参数。由于您无法迁移到JSF 2.解决方案可以使用Facelets,它可以让您实现EL函数。

你可以看到这个答案:

How to create a custom EL function to invoke a static method?

这篇文章

http://www.ibm.com/developerworks/web/library/j-facelets2/index.html