• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

accessing ServletContext in a Action file

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I have a servlet which i load on start up and put in the context. Now, i want to retrieve that servlet from the context and use it in a Action file, what should i do?

The class Action, which every action file extends doesn't have any method to get the servlet context.

please help,
Seshu
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Action's getServlet() method returns a reference to the ActionServlet, which has a getServletContext() message. So from your Action, in order to access the ServletContexst all you need to do is:

 
Sree Jag
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Seshu Varanasi:
Hi all,
I have a servlet which i load on start up and put in the context. Now, i want to retrieve that servlet from the context and use it in a Action file, what should i do?

The class Action, which every action file extends doesn't have any method to get the servlet context.

please help,
Seshu

 
Sree Jag
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jason that worked.







Originally posted by Seshu Varanasi:



Hi all,
I have a servlet which i load on start up and put in the context. Now, i want to retrieve that servlet from the context and use it in a Action file, what should i do?

The class Action, which every action file extends doesn't have any method to get the servlet context.

please help,
Seshu

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic