struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hubert Rabago <>
Subject Re: Why doesn't ActionForm's constructor have access to HttpServletRequest?
Date Tue, 03 Feb 2004 02:32:29 GMT
Not sure how your app is configured, but perhaps you could call an Action to
prepopulate your ActionForm, or help it by passing it the request object.

--- Jeff Skubick <> wrote:
> Is the absence of a reference to the HttpServletRequest object that
> triggered the creation of a new ActionForm object in its constructor a
> historical artifact or oversight, or was it an intentional decision whose
> motivation and rationale remains 100% valid and relevant today?
> At the moment, I'm in a quandry. I see no way to usefully use nested form
> beans to encapsulate administrable users in my web app without somehow
> getting a hold of a list of objects representing those administrable users
> from the session context of the user who's administering them (the list's
> composition depends partially upon the user doing the administration) so I
> can prepopulate the list for its initial display. 
> On the other hand, I'm worried that ActionForm's original creator was
> absolutely determined to keep ActionForm's constructor from ever knowing
> anything about the user or request that triggered its creation in the first
> place for some reason, like Struts casually re-using old ActionForm
> instances to satisfy new requests. On the other hand, I know it might just
> be a historical artifact that seemed like a good idea at the time, but
> doesn't really have any major implications either way.
> So... if I implement my own RequestProcessor class that overrides the
> default processActionForm method to call my own ActionForm-extending bean's
> constructor an explicitly pass it a reference to the HttpServletRequest
> object so it can fetch the HttpSession object and find the object that
> tells it everything else it needs to know to pre-populate the form bean
> prior to display, am I violating any sacred assumption made by other parts
> of Struts? Or am I OK?

Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message