I am able to set HSTS header in each JSP page using below code snippet
<% response.setHeader("Strict-Transport-Security" ,"max-age=7776000" );%>
but Unable to set HSTS header for one of my js files in my code which was reported by Security scan team.