You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Oscar <os...@gmail.com> on 2010/06/23 20:03:04 UTC

IMPORTANT Call action on application deploy, like servlet with load-on-startup (Struts 2)

Hi to all, i have the next situation: I need to call an action on
application startup like you can call a servlet on application startup
by setting <load-on-startup> parameter servlet on web.xml . I can't
use a servlet because i need to trigger my interceptors that
initialize JPA EntityManager . Is there a way to achieve this?

Best regards.

-- 
Oscar Calderón
SCJP 6
http://www.javahowto.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: IMPORTANT Call action on application deploy, like servlet with load-on-startup (Struts 2)

Posted by Oscar <os...@gmail.com>.
I've consider that, but the problem is that i want to define
dinamically the path of action, but to do that i need
HttpServletRequest object and inside init() i don't have access to
that object. I want to use httpServletRequest to extract server name
and context name.

2010/6/23 Gustavo Felisberto <gu...@wit-software.com>:
> Create a servlet that makes a request to the action.
>
> Gustavo Felisberto
>
> On 23 de Jun de 2010, at 19:03, Oscar <os...@gmail.com> wrote:
>
>> Hi to all, i have the next situation: I need to call an action on
>> application startup like you can call a servlet on application startup
>> by setting <load-on-startup> parameter servlet on web.xml . I can't
>> use a servlet because i need to trigger my interceptors that
>> initialize JPA EntityManager . Is there a way to achieve this?
>>
>> Best regards.
>>
>> --
>> Oscar Calderón
>> SCJP 6
>> http://www.javahowto.net/
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
Oscar Calderón
SCJP 6
http://www.javahowto.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: IMPORTANT Call action on application deploy, like servlet with load-on-startup (Struts 2)

Posted by Gustavo Felisberto <gu...@wit-software.com>.
Create a servlet that makes a request to the action. 

Gustavo Felisberto

On 23 de Jun de 2010, at 19:03, Oscar <os...@gmail.com> wrote:

> Hi to all, i have the next situation: I need to call an action on
> application startup like you can call a servlet on application startup
> by setting <load-on-startup> parameter servlet on web.xml . I can't
> use a servlet because i need to trigger my interceptors that
> initialize JPA EntityManager . Is there a way to achieve this?
> 
> Best regards.
> 
> -- 
> Oscar Calderón
> SCJP 6
> http://www.javahowto.net/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: IMPORTANT Call action on application deploy, like servlet with load-on-startup (Struts 2)

Posted by satyanarayana katta <sa...@gmail.com>.
If u have used spring in ur application then u can use the init-method.  Here is how it works

You can configure your war to load the spring upon app start-up.  The init method will auomatically get invoked.

Sent from my iPhone

On Jun 23, 2010, at 11:03 AM, Oscar <os...@gmail.com> wrote:

> Hi to all, i have the next situation: I need to call an action on
> application startup like you can call a servlet on application startup
> by setting <load-on-startup> parameter servlet on web.xml . I can't
> use a servlet because i need to trigger my interceptors that
> initialize JPA EntityManager . Is there a way to achieve this?
> 
> Best regards.
> 
> -- 
> Oscar Calderón
> SCJP 6
> http://www.javahowto.net/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org