• Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting path inside Tomcat.  RSS feed

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a question of implementation and best practices. I instantiate Class A inside my servlet, which in turn instantiates Class B. The problem is that Class B needs to load xslt stylesheets from WEB-INF/xslt. What is the best way for Class B to know where to load the sheets from? Right now I'm using context.getRealPath("/") within the servlet and then passing the path into Class A and subsequently Class B. Is there a better way to do this? Should I pass the context around instead?
I don't have this problem with my properties files, which are in the classes directory, where I can use getClass().getResourceAsStream("fileName"). I don't think this works outside the classes directory, however.
Thanks in advance.
 
Wes Hughes
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whoops...just noticed that this should probably be in Servlets. You can move if neccessary.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!