how to stop directory structure from being viewable in J2EE apps

Posted by Omnipresent on Stack Overflow See other posts from Stack Overflow or by Omnipresent
Published on 2010-03-25T16:33:13Z Indexed on 2010/03/25 16:43 UTC
Read the original article Hit count: 499

Filed under:
|
|

in a J2EE app if user explicitly takes out the the ending page name then what is the best way to not show the directory structure?

Example:

/mycoolapp/somefolder/test.jsp

/mycoolapp/somefolder/  -- this will show all the files under 'somefolder'

What is the best way to redirect or show the user a page saying 'not where you belong'. I want to avoid providing index.jsp in all the folders/subfolders of my application.

Appserver being used is GlassFish. Also the app is using Struts2 framework, though not all of the code is in struts2. Some code is using traditional Servlets

© Stack Overflow or respective owner

Related posts about java

Related posts about j2ee