Skip to content

Instantly share code, notes, and snippets.

@canujohann
Last active August 29, 2015 14:02
Show Gist options
  • Save canujohann/a5eaaf0d00b0b04708b7 to your computer and use it in GitHub Desktop.
Save canujohann/a5eaaf0d00b0b04708b7 to your computer and use it in GitHub Desktop.
Struts 1 : avoid direct access to JSP

avoid direct access to JSP

Avoid direct access to JSP in put JSP files into the web/src/class, or add the below code to your web.xml file:

<security-constraint> 

  <web-resource-collection> 
    <web-resource-name>Deny Direct Access</web-resource-name> 
    <description></description> 
    <url-pattern>*.jsp</url-pattern> 
  </web-resource-collection> 
    
  <auth-constraint> 
    <role-name>Denied</role-name> 
  </auth-constraint> 
  
</security-constraint> 

<security-role> 
  <role-name>Denied</role-name> 
</security-role>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment