struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kris Schneider <k...@dotech.com>
Subject Re: How to get a reference to an Action instance
Date Mon, 30 Dec 2002 13:57:33 GMT
As others have said, it's unclear exactly what it is you need to do, but here's
a general suggestion for having a tag handler and action play nicely together -
use scoped attributes. In other words, if your tag handler needs some
information from your action, have the action place the information in a request
(or session or application) attribute that the handler can access through its
current PageContext. Of course, this implies that the action operates on the
request before the JSP...

Quoting Martin Cooper <martinc@apache.org>:

> On Sun, 29 Dec 2002, Lirian Ostrovica wrote:
> 
> > Hi,
> >
> > I need to access an Action instance (I have its class name) while
> > writting a Tag.
> >
> > I have seen that ActionServlet stores Action instances in a 'protected'
> > variable (FastHashMap), and so far the only way I can see, is to extend
> > ActionServlet and write my own 'public' method to do the job.
> > But of course I do not prefer to extend ActionServlet just for that...
> 
> Even if you know the class name, there is no guarantee that an instance of
> that Action exists, since Action instances are created as needed. And even
> if an instance does exist, what would be the purpose of accessing it? An
> Action instance should not maintain state, since that will cause threading
> problems, and if you need to access class data, then you do not need an
> instance.
> 
> Perhaps if you tell us what you are trying to achieve, we can help you
> find the right way to do that.
> 
> --
> Martin Cooper
> 
> 
> >
> > If there is any other way, can someone please let me know
> >
> > thanks a lot
> >
> > lirian
> >
> >
> > >
> >
> >
> > --
> > To unsubscribe, e-mail:  
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
> >
> >
> 
> 
> --
> To unsubscribe, e-mail:  
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>

-- 
Kris Schneider <mailto:kris@dotech.com>
D.O.Tech       <http://www.dotech.com/>

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


Mime
View raw message