Reputation: 698
I have a main module C-portlet that contains in the folder resources a pdf file.
resources/webapp/files/cg.pdf
I have a war theme. In one of its jsp page, i need to add a link for the cg.pdf.
For now, i have :
<a target="_blank" href="/o/Cportlet/src/main/resources/META-INF/resources/webapp/files/cg.pdf"><liferay-ui:message key="cg-link"/></a>
but it doesn't work.
Last point, this pdf could be changed at anytime without a deploy again a module / war.
Is anyone have an idea ?
Thanks
Upvotes: 1
Views: 898
Reputation: 3688
There are several ways to do this: imagining you cannot use the regular documents library... Or you module cannot use the library to get resources..
You could use a resource action if you have an MVC portlet. This would be the simplest way to just serve that resource, and you would only need to put the MVC resource command URL in you jsp. Regular portlets can also provide resources but not as easily.
For general modules you can create a struts action..which are normally way more complicated, especially if the resource is for private use only.
Upvotes: 0
Reputation: 346
You can put your pdf file in one of your theme resource folders (for example the "templates" folder).
Now you can use themeDisplay.getPathThemeTemplates() + "/cg.pdf"
or within your theme with freemarker "${templates_folder}/cg.pdf"
Upvotes: 1