Re: [s2] accessing servlet context from an action

2007-03-23 Thread Piero Sartini
> I'm looking at the javadoc for this, it doesn't say much. Do I just > create a class scope variable for the session context and then set > that from the argument in the set method? That is exactly how it works. You might want to look at ServletSessionAware, ServletRequestAware, ServletResponseA

Re: [s2] accessing servlet context from an action

2007-03-23 Thread Chris Cheshire
Thank you muchly! On 3/23/07, Dave Newton <[EMAIL PROTECTED]> wrote: --- Chris Cheshire <[EMAIL PROTECTED]> wrote: > I'm looking at the javadoc for this, it doesn't say > much. Do I just create a class scope variable for the > session context and then set that from the argument > in the set meth

Re: [s2] accessing servlet context from an action

2007-03-23 Thread Dave Newton
--- Chris Cheshire <[EMAIL PROTECTED]> wrote: > I'm looking at the javadoc for this, it doesn't say > much. Do I just create a class scope variable for the > session context and then set that from the argument > in the set method? Yep. > Is this set method called automagically by the > framework

Re: [s2] accessing servlet context from an action

2007-03-23 Thread Chris Cheshire
On 3/23/07, Piero Sartini <[EMAIL PROTECTED]> wrote: > However, I am completely lost with Struts 2. Everything servlet > dependent is abstracted away "somewhere". I've been looking at the > tutorials and they don't cover this kind of thing at all. > > How do I go about putting the equivalent in a

Re: [s2] accessing servlet context from an action

2007-03-23 Thread Piero Sartini
> I will create a FAQ entry. good idea. maybe it makes sense to merge it with this one: http://struts.apache.org/2.0.6/docs/how-can-we-access-the-httpservletrequest.html Piero - To unsubscribe, e-mail: [EMAIL PROTECTED] For addi

Re: [s2] accessing servlet context from an action

2007-03-23 Thread Dave Newton
--- Piero Sartini <[EMAIL PROTECTED]> wrote: > An action class can implement ServletContextAware - > you have to implement a method setServletContext(ServletContext > servletContext) then. > > Another way is to use ServletActionContext.getServletContext(); Definitely use these over what I suggest

Re: [s2] accessing servlet context from an action

2007-03-23 Thread Piero Sartini
> However, I am completely lost with Struts 2. Everything servlet > dependent is abstracted away "somewhere". I've been looking at the > tutorials and they don't cover this kind of thing at all. > > How do I go about putting the equivalent in an action with Struts 2? An action class can implement

Re: [s2] accessing servlet context from an action

2007-03-23 Thread Dave Newton
--- Chris Cheshire <[EMAIL PROTECTED]> wrote: > How do I go about putting the equivalent in an > action with Struts 2? I don't actually know if this is still valid, and I can't test it at the moment, but: http://struts.apache.org/2.x/docs/accessing-application-session-request-objects.html I beli

[s2] accessing servlet context from an action

2007-03-23 Thread Chris Cheshire
Hi, I'm familiar with Struts 1, looking at Struts 2. The web app I am working on needs to use data sources that are controlled by tomcat connection pooling and accessed through JNDI. For this I need access to the servlet context that the action is running under. Previously I had a base action cl