struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Skubick <>
Subject Why doesn't ActionForm's constructor have access to HttpServletRequest?
Date Mon, 02 Feb 2004 22:38:21 GMT
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?
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message