How to read a file when the application server starts

S

simon_s_li

Hi,

I need to be able to read a file when I start the application server.

Can some please help me.

I would example some examples.

Regards
Simon
 
L

Larry

In your web.xml file, you can specify to load a servlet on statup:

<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>

<load-on-startup>1</load-on-startup>
</servlet>

Put your code for reading the file in the init() method of that servlet.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top