I am trying to dynamically generate an XML file and loading it when the application starts using PL/SQL . The application uses Tomcat server.
The application uses an abc.xml file. This xml file, currently, is a static file.
I want to:
1) Dynamically generate the above XML file using some information in database.
2)Load the dynamically generated xml file when the application starts.
Point 1 is not a problem. I have problems in implementing point 2.
Can any one tell me how can I load this dynamically generated XML file when the application starts?
I need some guidance in dynamically loading a file.
I created a small test web application that only has index.jsp. I have not created index.jsp directly. Instead, I have written a class that implements ServletContextListener interface. The contextInitialized method creates (using BufferedWriter) the index.jsp file.
When I start tomcat, it creates the index.jsp file in my C (C:\Eclipse WorkSpace\Test1\WebContent) drive (I cannot see the addition of index.jsp in eclipse yet). But when I hit index.jsp from the browser it says file not found. If I go back and refresh the eclipse project (now I can see the index.jsp file in eclipse ide), and then hit index.jsp from the browser; it displays the jsp page.
I think the problem is index.jsp page is created after the application is deployed. That may be the reason, tom cat cannot display the index.jsp page at first time. Then if I go and refresh the project in eclipse, then tom cat can display the index page.
I have made context reloadable to be true.
How can we ensure that after generating the file through contextInitialized method, Tomcat can immediately render the generated file and display it on the browser?
Please let me know how can we solve this problem?
Matt Thomassan wrote:I created a small test web application that only has index.jsp. I have not created index.jsp directly. Instead, I have written a class that implements ServletContextListener interface. The contextInitialized method creates (using BufferedWriter) the index.jsp file.
This doesn't sound like a very useful idea to me. What was your reason for doing that? Instead of something more normal, I mean. Like having the contextInitialized method just set up the data in some kind of beans and having the index.jsp file display that data using JSTL?