0

我在我的项目中使用 JSF 2.0 和 Richfaces 4.0。有一个模型作为下载文件,为此我使用 h:outputlink 下载文件。文件下载正确。但我使用图标显示下载选项并附加丰富:工具提示当鼠标悬停在该图标上但未显示时显示工具提示。如果我使用 a4j:commandlink 然后工具提示显示但我无法使用 a4j:commandlink 实现元素下载功能。谁能告诉我工具提示不适用于 h:outputlink 的原因是什么?这是我的代码...

<h:outputLink rendered="#{docList.docType=='FILE' and not empty docList.docName}" value="/FileDownload" title="Download Documents">
                            <f:param name="fileId" value="#{docList.docId}"/>
                            <f:param name="fileName" value="#{docList.docName}"/>
                            <f:param name="fileSize" value="#{docList.docLength}"/>
                        <h:graphicImage library="images" name="doc_save_icon.png" style="border:0;"/>
                        <rich:tooltip styleClass="tooltip" layout="block" mode="ajax" value="Download Documents">
                                 Download Documents
                        </rich:tooltip>
                    </h:outputLink>
4

1 回答 1

3

哦,你错过了 for 属性和 id 示例

<h:commandLink value="TEST12" action="STH" **id="cmdlnk"** />
<rich:toolTip **for="cmdlnk"**>This is test CMD Link</rich:toolTip>
<a4j:commandLink value="TEst" id="cmdlnka4j"></a4j:commandLink>
<rich:toolTip for="cmdlnka4j">This is test A4j LInk</rich:toolTip>

您的新代码:

<h:outputLink id="fileDld" rendered="#{docList.docType=='FILE' and not empty docList.docName}" value="/FileDownload" title="Download Documents">
                        <f:param name="fileId" value="#{docList.docId}"/>
                        <f:param name="fileName" value="#{docList.docName}"/>
                        <f:param name="fileSize" value="#{docList.docLength}"/>
                    <h:graphicImage library="images" name="doc_save_icon.png" style="border:0;"/>
                    <rich:tooltip for="fileDld" styleClass="tooltip" layout="block" mode="ajax" value="Download Documents">
                             Download Documents
                    </rich:tooltip>
                </h:outputLink>
于 2011-05-13T10:10:14.187 回答