It's a matter of granularity.  My struts apps only have one servlet.  I think the idea is to have these events at the action level, per ActionForm.  A filter is at the servlet level.  As I understand it, I can have a filter associated with a servlet or a group of servlets.  So in my struts app, my filter will be invoked every single time a *.do request comes in. 
 
I suppose struts could do something with filters like has been done with the struts action servlet, but even in that case we would not be creating filters, we'd be implementing some struts interface, as we do with Actions.
 
So to summarize, assuming the struts framework as it is today, filters do not help us get an event when a particular ActionForm is used.  Filters might be part of the solution in a new struts architecture, but by themselves they don't provide the functionality suggested in Jeff's proposal.  
 
Taylor
----- Original Message -----
Sent: Monday, June 11, 2001 4:23 PM
Subject: RE: Proposal

Really?  Why not write a filter that invokes "beforePagerRendered()" before invoking "chain.doFilter()", then invoking "afterPageRendered()" after invoking "chain.doFilter()"?
 
It seems to me that filters do *exactly* then thing that you claim they do not.  Could you please elaborate why you believe filters wouldn't implement these behaviours?
 
-dan
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Taylor Cowan
Sent: Monday, June 11, 2001 8:04 PM
To: [EMAIL PROTECTED]
Subject: Re: Proposal

I think this is a very good proposal.  I would not use the action identifiers.  They should just be methods of the listener interface:
 
public void beforePagerRendered(...)
public void afterPageRendered(...)
 
This seems to be similar to filters, but 2.3 filters don't solve this problem for a struts app. 
 
Taylor
 
----- Original Message -----
From: Jeff Trent
Sent: Wednesday, June 06, 2001 10:21 AM
Subject: Proposal

New here ... so bare with me.
 
I'd like to propose the following enhancement to ActionForm:
 
    public void addListener(ActionFormListener);
    public void removeListener(ActionFormListener);
 
 Here is the basics of ActionFormListener I'm interested in to start out with:
 
    public abstract class ActionFormListener
    {
        public static final int ACTION_TYPE_PAGE_PRE_RENDERED = 1;
        public static final int ACTION_TYPE_PAGE_POST_RENDERED = 2;
 
        public abstract void actionFormNotify(int actionType, String context /* reserved for future use*/);
    }
 
 
---
 
These messages would be sent before and after the RequestDispatcher included or forwarded to the JSP page.
 
The primary reason I'm propsing this feature is to allocate / free (respectfully) scarce resources that I would like to be made available on the page that I do not want to serialize to transient members of my form.
 
thank you,
jeffrey trent
 

Reply via email to