Search code examples
javahtmlgrails

Not able to access file inside assets folder in java


I want to open a file inside [assets/cv] folder and i tried using this two method for opening file when clicked in button but it is not working.The file i want to open is .pdf type and it is not downloading the file.

.gsp file

<td>
    <a href="C:\\Users\\Ashwin\\businessapp\\src\\main\\webapp\\assets\\cv\\"+"${trainuserLists.cvName}" download>View CV</a>
</td>

Another method

<td>
    <a href="${application.contextPath}/static/assets/cv/${trainuserLists.cvName}" download>View CV</a>
</td>

Solution

  • Try using the assetPath method in your gsp like in this example.

    <link href="${assetPath(src: 'manifest.json')}"/>

    The documentation might give you some pointers too.