Search code examples
jsf-2richfacestooltipdownloadcommandlink

Richfaces tooltip not working for h:outputlink tag?


I am using JSF 2.0 & Richfaces 4.0 for my project.There is one model as download file and for that purpose I used h:outputlink to download file.The file downloads properly.But i used icon to show download option & attached rich:tooltip to show tooltip when mouse hover on that icon but it is not showing.If I used a4j:commandlink then tooltip shows but i cant implelement download functionality using a4j:commandlink. Can anybody tell me what is the reason that tooltip is not working for h:outputlink? Here is my code...

<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>

Solution

  • Oh you missed sth the for attribute and id example

    <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>
    

    Your New Code :

    <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>