I have a map named file
I'm receiving from my controller which contains the path and description of a file stored in assets/myfiles/file.pdf the following format:
{"filepath": "file.pdf",
"description": "something"}
How do I create a link to this pdf in a GSP page I'm rendering?
<a href="${resource(dir: 'myfiles', file:' ${file[filename])' }" target="_blank">${file[description]}</a>
I tried the above but it doesn't open the pdf but just another cloned tab of the app
Create Controller Method And Write A Connection To Download Your File.
GSP:
Write the Button And Create A link To this Controller Action In Your GSP like below.
Controller:
[OR]
Note:
resource : You can pass Instance to your download action.
target="_blank" : Open/Download File In New Tab.
action : Action name that is defined in Controller.