Monday, June 27, 2011

Determining Absolute Path in a Web Application

I was looking at the NetBeans EE forums, and someone asked how to determine the path in a web application. This is a common question so I thought I would provide two examples. The first is a servlet which returns the absolute path to the web application root. The other is a JSF application that does the same thing, and lists the files.
Note: The code is based on Java EE 6.

PathServlet.java



DirectoryLister.java



index.xhtml


0 comments :

Popular Posts