You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Anuradha S.Athreya" <an...@world2web.com> on 2005/08/20 08:01:10 UTC
Overriding the init() method in the Action Servlet.
Hello,
I understand it is possible to override the init() method in the Action
Servlet class. How can I go about achieving this? What are the changes that
I need to make in the web.xml. I need to introduce this in my application,
since I need to initialize certain parameters during application start up.
Regards,
Anuradha S.Athreya
Re: Overriding the init() method in the Action Servlet.
Posted by Laurie Harper <la...@holoweb.net>.
Another option is to have your startup code in its own, separate servlet
(or you could use a context listener). Unless you specifically need to
alter behaviour of the standard ActionServlet, keeping your startup code
separate probably makes more sense.
L.
Sudhaker Raj wrote:
> You can try struts-plugin to execute startup code. I would avoid
> making changes in core behaviors if possible without changing them.
>
> On 8/20/05, Anuradha S.Athreya <an...@world2web.com> wrote:
>
>>Hello,
>>
>>
>>
>>I understand it is possible to override the init() method in the Action
>>Servlet class. How can I go about achieving this? What are the changes that
>>I need to make in the web.xml. I need to introduce this in my application,
>>since I need to initialize certain parameters during application start up.
>>
>>
>>
>>
>>
>>Regards,
>>
>>Anuradha S.Athreya
>>
>>
>>
>>
>>
>>
>>
>>
>>
--
Laurie, Open Source advocate, Java geek and novice blogger:
http://www.holoweb.net/laurie
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Overriding the init() method in the Action Servlet.
Posted by Joe Germuska <Jo...@Germuska.com>.
At 12:23 PM -0400 8/20/05, Sudhaker Raj wrote:
>You can try struts-plugin to execute startup code. I would avoid
>making changes in core behaviors if possible without changing them.
I would agree with this, and with Wendy's post. If you need certain
things to happen at servlet initialization time, there are better
ways to do it than subclassing ActionServlet. The PlugIn interface
was designed explicitly for this purpose, and later (Servlet 2.3),
the ServletContextListener became a more standard way of doing the
same thing.
Joe
>On 8/20/05, Anuradha S.Athreya <an...@world2web.com> wrote:
>> Hello,
>>
>>
>>
>> I understand it is possible to override the init() method in the Action
>> Servlet class. How can I go about achieving this? What are the changes that
>> I need to make in the web.xml. I need to introduce this in my application,
>> since I need to initialize certain parameters during application start up.
>>
>>
>>
>>
>>
>> Regards,
>>
>> Anuradha S.Athreya
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
--
Joe Germuska
Joe@Germuska.com
http://blog.germuska.com
"Narrow minds are weapons made for mass destruction" -The Ex
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Overriding the init() method in the Action Servlet.
Posted by Sudhaker Raj <su...@gmail.com>.
You can try struts-plugin to execute startup code. I would avoid
making changes in core behaviors if possible without changing them.
On 8/20/05, Anuradha S.Athreya <an...@world2web.com> wrote:
> Hello,
>
>
>
> I understand it is possible to override the init() method in the Action
> Servlet class. How can I go about achieving this? What are the changes that
> I need to make in the web.xml. I need to introduce this in my application,
> since I need to initialize certain parameters during application start up.
>
>
>
>
>
> Regards,
>
> Anuradha S.Athreya
>
>
>
>
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Overriding the init() method in the Action Servlet.
Posted by Wendy Smoak <ja...@wendysmoak.com>.
From: "Anuradha S.Athreya" <an...@world2web.com>
> I understand it is possible to override the init() method in the Action
> Servlet class. How can I go about achieving this? What are the changes
> that
> I need to make in the web.xml. I need to introduce this in my application,
> since I need to initialize certain parameters during application start up.
If you're on a Servlet 2.3 (or later) container, use a
ServletContextListener instead:
http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/ServletContextListener.html
Here's a recent thread about the same topic:
http://www.mail-archive.com/user@struts.apache.org/msg21482.html
--
Wendy Smoak
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Overriding the init() method in the Action Servlet.
Posted by Mark Benussi <ma...@hotmail.com>.
In the web.xml your servlet for handling struts requests should currently be
org.apache.struts.actions.ActionServlet. Change this class to you own that
extends this class and then you can override any methods
-----Original Message-----
From: Anuradha S.Athreya [mailto:anuradhasa@world2web.com]
Sent: 20 August 2005 07:01
To: 'Struts Users Mailing List'
Subject: Overriding the init() method in the Action Servlet.
Hello,
I understand it is possible to override the init() method in the Action
Servlet class. How can I go about achieving this? What are the changes that
I need to make in the web.xml. I need to introduce this in my application,
since I need to initialize certain parameters during application start up.
Regards,
Anuradha S.Athreya
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org