我有一个表格,每次单击单元格都会使用 componentControl 标签打开一个工具提示,这很有效。但我想将参数传递给工具提示,每个表格单元格都不同。
<rich:toolTip id="tooltip" attached="false" mode="ajax">
<ui:include id="projectDetailInclude" src="projectDetail.xhtml">
<ui:param name="projectDetail" value="#{projectBean.getProjectDetail(project, index)}" />
</ui:include>
</rich:toolTip>
<rich:dataTable id="detailDataTable" var="row" value="#{projectBean.projects}">
<rich:column id="rowLabelColumn">
<h:outputText value="#{row.label}" />
</rich:column>
<rich:columns id="detailColumns" var="column" value="#{projectBean.columns}" index="index" >
<f:facet name="header">
<h:outputText value="#{column}" />
</f:facet>
<div id="projectDetailBlock" class="#{row.values[index]}">
<rich:componentControl event="onclick" for="tooltip" operation="show">
<f:param name="project" value="#{project}" />
<f:param name="index" value="#{index}" />
</rich:componentControl>
</div>
</rich:columns>
</rich:dataTable>
在上面的代码中,我尝试传递项目和索引参数。我得到的只是一个不错的堆栈跟踪。(删除 componentControl 标记中的参数时消失)。
java.lang.StackOverflowError
java.lang.reflect.InvocationTargetException.<init>(InvocationTargetException.java:54)
sun.reflect.GeneratedMethodAccessor208.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1773)
org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.java:1132)
org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:686)
org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:715)
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:290)
org.ajax4jsf.javascript.ScriptUtils.writeScriptToStream(ScriptUtils.java:168)
org.ajax4jsf.javascript.ScriptUtils.writeScriptToStream(ScriptUtils.java:174)
org.ajax4jsf.javascript.ScriptUtils.writeScriptToStream(ScriptUtils.java:83)