Re: How to get initialized at startup

2007-10-24 Thread vamsi

I am writing my own servlet for this as I didn't found anything.
As I feel I have more control on that.
post it if you got solution for this one.
- Original Message - 
From: Brian Hawkins [EMAIL PROTECTED]

To: user@struts.apache.org
Sent: Tuesday, October 23, 2007 3:06 AM
Subject: How to get initialized at startup



I'm pretty new to Struts2.

I have some code I need to initialize when the servlet comes up for the
first time.  How do I do that when I'm using struts and I do not have my 
own

servlet?  Do I create a servlet just for this purpose?

Thanks
Brian




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to get initialized at startup

2007-10-24 Thread Brian Hawkins
I did what Sartini suggested.  I implemented the ServletContextListener
interface and added it as a listener to my application.  I use it to create
and take down some database connections that I need for my application.  It
works really well.

Brian

On 10/24/07, vamsi [EMAIL PROTECTED] wrote:

 I am writing my own servlet for this as I didn't found anything.
 As I feel I have more control on that.
 post it if you got solution for this one.
 - Original Message -
 From: Brian Hawkins [EMAIL PROTECTED]
 To: user@struts.apache.org
 Sent: Tuesday, October 23, 2007 3:06 AM
 Subject: How to get initialized at startup


  I'm pretty new to Struts2.
 
  I have some code I need to initialize when the servlet comes up for the
  first time.  How do I do that when I'm using struts and I do not have my
  own
  servlet?  Do I create a servlet just for this purpose?
 
  Thanks
  Brian
 


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




How to get initialized at startup

2007-10-22 Thread Brian Hawkins
I'm pretty new to Struts2.

I have some code I need to initialize when the servlet comes up for the
first time.  How do I do that when I'm using struts and I do not have my own
servlet?  Do I create a servlet just for this purpose?

Thanks
Brian


Re: How to get initialized at startup

2007-10-22 Thread Piero Sartini
 I have some code I need to initialize when the servlet comes up for the
 first time.  How do I do that when I'm using struts and I do not have my
 own servlet?  Do I create a servlet just for this purpose?

If you need something that is initialized when your webapp starts, I would 
suggest to write a ContextListener. For more information look at:
http://wiki.metawerx.net/wiki/ContextListener

Btw, in Struts 2 you do not use servlets but Actions.

Piero

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]