Hi Experts,

I have written a Servlet file which sends email to a user .When if i run that servlet file in command Prompts it sends a email .Now i want that servlet file to be automatically executed inside my Tomcat server within a stipulated Time . Sothat it can send automatic reminder emails .How is it Possible..pls Help me . I have tried a lots but still i can't make it out. I also add listener in my web.xml file then also i can't get my requirements.....Pls help me out

Thanx in Advance

Recommended Answers

All 3 Replies

it's easy. Start a Timer inside the servlet init method, set the servlet to load on web application startup, and away you go.

it's easy. Start a Timer inside the servlet init method, set the servlet to load on web application startup, and away you go.

Yes i can start a timer inside the servlet init Method but how to set the servlet sothat it will startup automatically in my web application. Do i use listener in web.xml or any other way are there so that my servlet will automatically load on web application

check the servlet specification. There's a simple flag you can set on a servlet declaration in the web.xml that causes the container to load the servlet during application startup.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.