aspose file tools*
The moose likes JSP and the fly likes Read files under WEB-INF directory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Read files under WEB-INF directory" Watch "Read files under WEB-INF directory" New topic
Author

Read files under WEB-INF directory

Yuvi Gupta
Greenhorn

Joined: Apr 25, 2013
Posts: 9

Hi Guys,
I want to get List of all files name(jsp etc) which is under WEB-INF directory. i tried lot but i couldn't do that. Any one can please post the code.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

Welcome to the Ranch.

What have you tried? Please post your code. At CodeRanch, you don't get the code handed to you, you get lots of help with your code.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Yuvi Gupta
Greenhorn

Joined: Apr 25, 2013
Posts: 9

Hi Bear Bibeault ,
I have solved my problem by the following statement. Thanks
String [] f=new File(getServletContext().getRealPath("WEB-INF")).list();




Ivan Jozsef Balazs
Rancher

Joined: May 22, 2012
Posts: 865
    
    5
getResourceAsStream might be a better choice - as getRealPath returns null if the servlet container cannot translate the virtual path to a real path for any reason (such as when the content is being made available from a .war archive).

How to load a resource from WEB-INF directory of a web archive - Stack Overflow
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Read files under WEB-INF directory
 
Similar Threads
struts taglib issue
taglib uri error
Request Resource not available.
root context need help
Unable to load tag handler class!!!