Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

getRealPath() method  RSS feed

 
Anthony Karta
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

In init() method, I get the path like this:

ServletContext context = config.getServletContext();
String path = context.getRealPath("/");

In doGet(), when I try to display it - out.println(path) - it shows null

do I miss something here? path is String (class variable)

thanks all
anthony
 
Julian Kennedy
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tony,

path may be a class variable, but by putting String in front of it like that in the method you're declaring it as local, so you're not assigning the value to the class variable. Otherwise it'll work fine.

Jules
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!