Remove back button using a custom parameter in the URL

Remove back button using a custom parameter in the URL

Challenge : I am using JRS 5.0. I have developed a dashboard based on a couple of high level reports. My dashboard reports allow me to drill through more detailed reports. My issue is that when I open those detailed reports, the back button on the top of it doesn't bring me back to the dashboard as some of my users might think so I would like to remove the back button when I open the report through the dashboard. Note: This is only one use case, you may very easily use this example to perform an unlimited number of transformation on any JSP page the same way.

Answer : I will use my own parameter which I'm passing in the URL when drilling through to the report to remove the back button.

Step 1: I am willing to remove the back button from the report page so first I locate ViewReport.jsp.

open \apache-tomcat\webapps\jasperserver-pro\WEB-INF\jsp\modules\viewReport\ViewReport.jsp

Step 2: locate the button with id="back". By default in v5.0 this is around line 155

Step 3: Wrap the button into 'c:if' tags.

Note 1: that the parameter I will use in this example is called 'isDrilling' and that I don't need to define it anywhere to use it.

Note 2: I am using param.isDrilling to retrieve the value of the parameter called isDrilling and defined in my URL instead of using request.getParameter("isDrilling")  as the latter will not resolved by EL. Request parameter can only be accessed using implicit variable  param . hence  ${param.lang}

Step 4: Now I can access the report using its normal URL + appending 'isDrilling=true' at the end

Browse to your typical report link adding &isDrilling=true at the end of the URL so that it looks llike this: hostname>:/jasperserver[-pro]/flow.html?_flowId=viewReportFlow&standAlone=true&_flowId=viewReportFlow&ParentFolderUri=[path/to/myReport]&isDrilling=true

Note : In this example we have removed the back button but similarly you may be able to change anything from the JSP based on that custom parameter.