struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Villalba Arias, Fredy [BILBOMATICA]" <>
Subject RE: Accessing ActionForm from Servlet (was: Pajes + Struts)
Date Wed, 04 Feb 2004 13:54:11 GMT
Thanx Joe, Andrew... you seem to have grasped the essence of my worries.

Andrew: on your comment about Pajes (jejeje), yes. It's a nice simple framework I've been
working with for about 2 years now. I confess I have
not been interested to become a Guru at it or something like that, but
that's mostly because the core objects (the DOM objects to
dinamycally manipulate an HTML template) were simple and sufficient
enough for achieving what I wanted. I recommend you to take a look at
it. It's worth it. About XMLC, had never heard of it. I might give it a
look (when I have time!).

Anyway, let me comment on your posting, Joe (read below):

>These are initial steps towards making it easier 
>to get an ActionForm instance for prepopulation 
>on the way to the view.  Be warned, this method 
>does not use any of the logic for looking up an 
>existing form bean in request or session scope 
>under any name, either the forms name or the 
>'attribute' property of an ActionMapping, since 
>as you can see, the method gets neither a request 
>or an action mapping.


I suppose you say this about the action mapping because it's
possible that very same ActionForm is being used from more than
one Action. Am I right?

In any case, Struts takes care of handling for you the association between Action and ActionForm,
including management of important aspects such as
Scope. Regarding the scope issue, I don't think it would be a problem since,
by the time the control is delegated (ActionForward-ed) to the external component:

(1) The Action's job is finished (execute / perform) -- at least, for that request.

(2) The Action is already associated to the appropriate ActionForm and will
remain so until the response is sent back (or further, depending on the scope, right?).

(3) It is not possible to have more than one ActionForm associated to an
Action (at the same time), i.e. it's a 1:1 relationship (again, am I right?)

That's why I thought: if I can recover that very same ActionForm object once
accessible from the just-executed Action (the "actionForm" attribute), then voila! (I believe
that very same object is the one accessed through the
JSP-tags, isn't it?).

However, I don't see how can the first issue affect me... if what I just stated is true, that
is. Do you?

>I have been thinking about adding a method:
>RequestUtils.createActionForm(fbc, servlet, 
>request, scopeString, attributeString) which 
>would integrate that logic as well, but I was 
>waiting to make sure that no one objected to what 
>I did a few weeks ago.  Actually, I would also 
>prefer to use a different method name like 
>'findOrCreateActionForm' but I don't love that 
>name, so I'm also waiting to come up with a 
>method name that I like.

A nice method to have would be something like:

getCurrentActionForm(HttpServletRequest r, Action a) or
getCurrentActionForm(HttpServletRequest r, Class actionClass)

However, I don't know if I'm saying something stupid here,
since I have the doubts I just stated above.

>Also, there has been a lot of effort to factor 
>certain things out of RequestUtils, so maybe it's 
>time to find a different home for these methods. 

Definitively YES!

Joe Germuska       
       "Imagine if every Thursday your shoes 
exploded if you tied them the usual way.  This 
happens to us all the time with computers, and 
nobody thinks of complaining."
             -- Jef Raskin

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

Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003

Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003

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

View raw message