Forums Register Login

Link to a file using h:outputLink tag.

+Pie Number of slices to send: Send
Hi all,

I'd like to know if the h:outputLink of the JSF can only render to another page. I want to create a link to a file in my directory system and I'd like to create a link for it in a datatable.

Could anyone point me?

Thanks in advance!
+Pie Number of slices to send: Send
<h:outputLink value="#{facesContext.externalContext.request.contextPath}/local_Dir/#{file.name}">
<h:outputText value="#{file.name}"/>
</h:outputLink>

#{facesContext.externalContext.request.contextPath} will get you to the root directory of your running application.
No more fooling around. Read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 4568 times.
Similar Threads
setting value for ID attribute dynamically for rich:modalpanel (for templating overlay)
How to download tgz file using jsp in browser
response.setContentType("application/download"); not working
Issue with tomahawk's sorting feature with hyperlink contents
Error happen when using <c:if>
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 20:28:44.