• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do I retrieve path information to the.jsp files in a subdirectory of a web app?

 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm getting tired of writing a bean for every view within my webapp. So I want to have a subdirectory (way under web/WEB-INF/fee/fie/foe/fum)
that I can just place JSP files in, and then have my servlet display the JSP as a view, in the usual model-controler-view world. (I'm using @bear's frontman framework)

I know I can ask the class loader for all the resources, and recursively chase though the tree. Is there an easier way?

Since its under web/WEB-INF/fee/fie/foe/fum, can I short circuit the scanning?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64720
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what your question has to do with beans, so I may be missing something...
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It happens to be a bean, not very relevant to the question. The fundamental question is about how a servlet/bean can find a file within the jar/war that its running in.
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is some code that I've been playing with, trying to figure this out:



When I run it, I get output:



The good news is that the real path to the war/jar is " /Users/pfarrell/sandbox/wayserver/webapi/build/"
and the usual WAR stuff is in /web/ and all the interesting JSP stuff is in /web/WEB-INF/

The bad news is that I still have no idea how to get a handle to whatever is the lead, to the place where I really want:
/web/WEB-INF/fee/fie/foe/fum/*.jsp
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic