• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to use application.getRealPath()  RSS feed

 
Srikanth Adapa
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I need to retrieve a document which is external to .war file and with in the same server location. I dont want to hard code the file location path in my jsp. Is there any other alternative by using getRealPath() method. Pl let me know how to use application.getRealPath() if it makes any sense.


Hoping to hear from you soon
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ServletContext#getRealPath() just returns an absolute file system path for the given relative webcontent path.
I dont want to hard code the file location path in my jsp.

You should also not write Java code in JSP files. Use Java classes and configuration files.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!