You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Asim Ghosh <as...@yahoo.co.uk> on 2004/06/24 08:19:08 UTC

how do i get the reference of ServletContext in Action Class

hello guys,
 
  can any one tell me that how do i get the reference of ServletContext in Action Class.
 
asim

		
---------------------------------
 ALL-NEW Yahoo! Messenger - sooooo many all-new ways to express yourself 

RE: how do i get the reference of ServletContext in Action Class

Posted by Asim Ghosh <as...@yahoo.co.uk>.
Action class is derived from Object class. Action class doesn't have any getServletConfing or getServletContext(). ActionServlet has those methods. But i need the ref. of ServletConfig or ServletContext in Action class.

Alex Epelde <ae...@entelibai.com> wrote:Action class has a getServletConfig method which returns a ServletConfig
object. You can get a reference to the ServletContext object throught
this object's getServletContext() method.

I also think you can directly call Action's getServletContext() (which
is inherited from GenericServlet) depending of your servlet api version.

-----Mensaje original-----
De: Asim Ghosh [mailto:asimghosh26@yahoo.co.uk] 
Enviado el: jueves, 24 de junio de 2004 8:19
Para: user@struts.apache.org
Asunto: how do i get the reference of ServletContext in Action Class


hello guys,

can any one tell me that how do i get the reference of ServletContext
in Action Class.

asim


---------------------------------
ALL-NEW Yahoo! Messenger - sooooo many all-new ways to express yourself



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



		
---------------------------------
 ALL-NEW Yahoo! Messenger - sooooo many all-new ways to express yourself 

RE: how do i get the reference of ServletContext in Action Class

Posted by Alex Epelde <ae...@entelibai.com>.
Action class has a getServletConfig method which returns a ServletConfig
object. You can get a reference to the ServletContext object throught
this object's getServletContext() method.

I also think you can directly call Action's getServletContext() (which
is inherited from GenericServlet) depending of your servlet api version.

-----Mensaje original-----
De: Asim Ghosh [mailto:asimghosh26@yahoo.co.uk] 
Enviado el: jueves, 24 de junio de 2004 8:19
Para: user@struts.apache.org
Asunto: how do i get the reference of ServletContext in Action Class


hello guys,
 
  can any one tell me that how do i get the reference of ServletContext
in Action Class.
 
asim

		
---------------------------------
 ALL-NEW Yahoo! Messenger - sooooo many all-new ways to express yourself



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


RE: how do i get the reference of ServletContext in Action Class

Posted by Asim Ghosh <as...@yahoo.co.uk>.
Yes, the solution was same.
 
There is one method inside the Action class i.e getServlet which returns the associated ActionServlet. Once u have the ref. of this class u can call getServletConfig or getServletContext method.
 
asim

Jonathan Roberts <j_...@yahoo.co.uk> wrote:
>Thanx but i already solved it. 
>thanks again.

>asim

Hi Asim,

Was your solution the same?
It's always good to know what the solutions are to these problems for people searching through the achives, for the next person who has trhe same issue

Cheers

Jonathan



Asim Ghosh wrote:
Thanx but i already solved it. 
thanks again.

asim

Alex Epelde wrote:
Sorry, you should get a reference to the servlet calling your action's
getServlet() method. And then use the getServletConfig() or
getServletContext() methods. There is no getServletContext() method in
the Action class.

-----Mensaje original-----
De: Asim Ghosh [mailto:asimghosh26@yahoo.co.uk] 
Enviado el: jueves, 24 de junio de 2004 8:19
Para: user@struts.apache.org
Asunto: how do i get the reference of ServletContext in Action Class


hello guys,

can any one tell me that how do i get the reference of ServletContext
in Action Class.

asim


---------------------------------
ALL-NEW Yahoo! Messenger - sooooo many all-new ways to express yourself



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



---------------------------------
ALL-NEW Yahoo! Messenger - sooooo many all-new ways to express yourself 

---------------------------------
ALL-NEW Yahoo! Messenger - sooooo many all-new ways to express yourself 
		
---------------------------------
 ALL-NEW Yahoo! Messenger - sooooo many all-new ways to express yourself 

RE: how do i get the reference of ServletContext in Action Class

Posted by Jonathan Roberts <j_...@yahoo.co.uk>.
>Thanx but i already solved it. 
>thanks again.

>asim
 
Hi Asim,
 
Was your solution the same?
It's always good to know what the solutions are to these problems for people searching through the achives, for the next person who has trhe same issue
 
Cheers
 
Jonathan
 


Asim Ghosh <as...@yahoo.co.uk> wrote:
Thanx but i already solved it. 
thanks again.

asim

Alex Epelde wrote:
Sorry, you should get a reference to the servlet calling your action's
getServlet() method. And then use the getServletConfig() or
getServletContext() methods. There is no getServletContext() method in
the Action class.

-----Mensaje original-----
De: Asim Ghosh [mailto:asimghosh26@yahoo.co.uk] 
Enviado el: jueves, 24 de junio de 2004 8:19
Para: user@struts.apache.org
Asunto: how do i get the reference of ServletContext in Action Class


hello guys,

can any one tell me that how do i get the reference of ServletContext
in Action Class.

asim


---------------------------------
ALL-NEW Yahoo! Messenger - sooooo many all-new ways to express yourself



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



---------------------------------
ALL-NEW Yahoo! Messenger - sooooo many all-new ways to express yourself 
		
---------------------------------
 ALL-NEW Yahoo! Messenger - sooooo many all-new ways to express yourself 

RE: how do i get the reference of ServletContext in Action Class

Posted by Asim Ghosh <as...@yahoo.co.uk>.
Thanx but i already solved it. 
thanks again.
 
asim

Alex Epelde <ae...@entelibai.com> wrote:
Sorry, you should get a reference to the servlet calling your action's
getServlet() method. And then use the getServletConfig() or
getServletContext() methods. There is no getServletContext() method in
the Action class.

-----Mensaje original-----
De: Asim Ghosh [mailto:asimghosh26@yahoo.co.uk] 
Enviado el: jueves, 24 de junio de 2004 8:19
Para: user@struts.apache.org
Asunto: how do i get the reference of ServletContext in Action Class


hello guys,

can any one tell me that how do i get the reference of ServletContext
in Action Class.

asim


---------------------------------
ALL-NEW Yahoo! Messenger - sooooo many all-new ways to express yourself



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


		
---------------------------------
 ALL-NEW Yahoo! Messenger - sooooo many all-new ways to express yourself 

RE: how do i get the reference of ServletContext in Action Class

Posted by Alex Epelde <ae...@entelibai.com>.
Sorry, you should get a reference to the servlet calling your action's
getServlet() method. And then use the getServletConfig() or
getServletContext() methods. There is no getServletContext() method in
the Action class.

-----Mensaje original-----
De: Asim Ghosh [mailto:asimghosh26@yahoo.co.uk] 
Enviado el: jueves, 24 de junio de 2004 8:19
Para: user@struts.apache.org
Asunto: how do i get the reference of ServletContext in Action Class


hello guys,
 
  can any one tell me that how do i get the reference of ServletContext
in Action Class.
 
asim

		
---------------------------------
 ALL-NEW Yahoo! Messenger - sooooo many all-new ways to express yourself



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