| Author |
Path to a file
|
david allen
Ranch Hand
Joined: Sep 27, 2002
Posts: 185
|
|
Hi all, I have a site for uploading photos. Each upload is put into a photoAlbum( a file- sub directory) I have a JSP page that goes through all of these files and selects the first photo whose path is stored in a String array and then they are all displayed as the home page. The problem I am having is that the only way I can get it too work is by hard coding the path to the file where that contains my pages for the whole site, "C:\Apache\webapps\PhotoAlbums" I am concerned that this does not make it very portable. What I am after is somehow having a File pointer to "\webapps\PhotoAlbums" this what I can simply move the PhotoALbums directory without changing the code. Any ideas? Thanks David
|
 |
Trish Wu
Ranch Hand
Joined: Oct 09, 2002
Posts: 34
|
|
Programmatically, application.getResourcePaths(java.lang.String path) or application.getRealPath(java.lang.String path) application is an implicit variable of javax.servlet.ServletContext Declarativly, Put the hard coded path in the web.xml as an init-param
|
 |
david allen
Ranch Hand
Joined: Sep 27, 2002
Posts: 185
|
|
thanks for that. That is what I am after. David
|
 |
 |
|
|
subject: Path to a file
|
|
|