Richfaces tooltip componentcontrol param
I have a table where each cell click opens a tooltip using the componentControl tag, this works. But I wanted to pas a parameter to the tooltip, which is different per table cell.
<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 n开发者_StackOverflow中文版ame="index" value="#{index}" />
</rich:componentControl>
</div>
</rich:columns>
</rich:dataTable>
In the code above, i try to pass the project and index parameters. All i get is a nice stacktrace. (which disappers when removing the params in the componentControl tag).
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)
A similar case is covered in a RichFaces showcase example, so it should work: http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=componentControl
However the target of your component control is the show
method of the tooltip.js component js. The only parameter that the show
method takes is the event parameter, so your f:param
s aren't doing what you think.
Regardless, you shouldn't need the parameters in your componentControl, the EL in the value
attribute of your ui:param
should evaluate correctly for each row. What happens if you try the above code without those f:param
s?
精彩评论