struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rab yazbeck <rabli...@yahoo.co.uk>
Subject RE: accessing servlet from an ActionForm
Date Tue, 24 Jun 2003 21:10:43 GMT
But i am using it from within the ActionForm and not
from the ActionServlet. And with the ActionForm, I am
afraid that the "validate" and the "reset" are not
called by the <html:form>, this is why i am using the
constructor. any idea?

 --- Varun Garg <varun_garg@yahoo.com> wrote: > I
would access the ServletContext from the execute
> or the perform method
> rather than the constructor.
> 
> this.servlet.getServletContext().getAttribute("XXX")
> 
> This is what I use from inside the execute and it
> works great.
> 
> 
> -----Original Message-----
> From: rab yazbeck [mailto:rablists@yahoo.co.uk] 
> Sent: Tuesday, June 24, 2003 3:59 PM
> To: struts-user@jakarta.apache.org
> Subject: accessing servlet from an ActionForm
> 
> 
> Hi.
> 
> I am trying to get access to the servlet container
> (getServletContext().getAttribute(attrName)) from an
> ActionForm but I receive an error
> (NullPointerException). 
> 
> It is strange because the controller servlet
> instance
> (ActionServlet) exist in the ActionForm, but every
> time I try to access it, it gives me an error
> (NullPointerException).
> 
> The ActionForm is crated by an <html-el:form>, and I
> am trying to access this servlet from within the
> constructor of this ActionForm (is it good practice
> to
> do that?)
> 
> That attributes were already stored successfully
> (plug-in) at the start-up of the application.
> 
> Help please, thank you in advance.
> 
> Rab.
> 
> 
> __________________________________________________
> Yahoo! Plus
> For a better Internet experience
> http://www.yahoo.co.uk/btoffer
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
>  

__________________________________________________
Yahoo! Plus
For a better Internet experience
http://www.yahoo.co.uk/btoffer

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


Mime
View raw message