Open report in new tab using jasper plugin in grails

后端 未结 1 1390
清歌不尽
清歌不尽 2021-01-27 10:50

I am using jasper plugin to generate my report. All is fine but except my pdf is opening on the current tab, when I want to open it in a new tab.

I have no idea how to

相关标签:
1条回答
  • 2021-01-27 11:22

    This is going to be handled by the link you use to generate the report. Typically adding a target of _blank will do the trick. For example:

    <g:link controller="myReports" action="whateverReport" target="_blank">Click for your report</g:link>
    

    This will open the link in a new tab.

    If you are using a form adding target to the form will submit the form to a new tab. For example:

    <form name="myForm" action="whateverReport" method="POST" target="_blank">
    

    or

    <g:form name="myForm" controller="myReports" action="whateverReport" target="_blank">
    

    You could even do so with javascript window.open if you needed, but I will leave that example out of this answer as it's well documented elsewhere.

    0 讨论(0)
提交回复
热议问题