Results 1 to 3 of 3
- 05-21-2009, 03:24 PM #1
Member
- Join Date
- Aug 2008
- Posts
- 14
- Rep Power
- 0
- 10-05-2009, 10:06 PM #2
the best place to put things like data (xml files) is inside the WEB-INF folder, if it is desireable to have the XML file live within the web application. and then the method ServletContext#getResourceAsStream() is useful for figuring out the deployment-dependent path relative to the webapplication, and fetching you an open InputStream, which can then be used with the XML parsers.
If the XML file must exist externally to the web application, a good idea is to define an context parameter in the web.xml, or maybe use a JNDI environmnt variable name, which can be overridden with the container-specific deployment descriptor. for example, tomcat's context.xml could provider the resource binding for the physical external to the web application path, and the code inside your webapp would fetch a handle to the jndi variable name in a deployment-independent manner.
- 10-05-2009, 10:28 PM #3
Member
- Join Date
- Aug 2008
- Posts
- 14
- Rep Power
- 0
Similar Threads
-
Load file to data structure
By TinoJF in forum New To JavaReplies: 4Last Post: 03-31-2009, 03:16 PM -
Is there any way to transfer the file Streams from one servlet to another servlet .
By HenaPriyadarsini in forum Java ServletReplies: 0Last Post: 08-30-2008, 11:52 AM -
Not able to load a properties file
By Happy9959 in forum New To JavaReplies: 12Last Post: 07-29-2008, 07:15 AM -
how to load a servlet on index.jsp page...
By sujithc34 in forum Java ServletReplies: 1Last Post: 01-19-2008, 12:28 AM -
how to load a file in remote machine
By christina in forum New To JavaReplies: 1Last Post: 08-06-2007, 09:33 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks