struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dakota Jack <dakota.j...@gmail.com>
Subject Re: Correct Prepopulate Method
Date Fri, 11 Mar 2005 17:31:33 GMT
There is no right way.  However, if you think Action-centric rather
than page-centric everything is really easy.

If you do this, you won't think of the ActionForm as some sort of
mirror of the JSP/HTML form which stands between the Action and the
form.

Think, rather, of the Action as something that is called, processes
data, and forwards to somewhere.

Think of the data in the ActionForm as data in a repository available
to the Action.  You might want to populate the ActionForm dynamically
or otherwise.  That is not a problem.  A lot of the data you may want
to send to the JSP/HTML form may not come from a page at all.  You
need to remain flexible to do what you need to do.

The ActionForm mechanism is just a way to interface comfortably with
the <html:form> but should not somehow determine how you handle data. 
Usually my ActionForm relating to an Action itself is related at least
to two different (pre and post) JSP/HTML forms.  So the picture IS
NOT:

form A --> ActionFormA --> Action --> ActionFormB --> form B

but IS:

   Action 
      ^
      |
      v
  ActionForm
         ^
         |
         v
--------------------
^                  ^
|                   |
v                  v
form A       form B

Know what I mean?  Page-centric thinking is procedural programming.

Jack


<SNIP>
On Fri, 11 Mar 2005 09:53:01 -0700, Schuster Joel M Contr ESC/NDC
<Joel.Schuster@cisf.af.mil> wrote:
> Ok, then what am I missing?
> 
> I have a jsp/html form that needs to be 'pre-populated' with dynamic fields
> from a table in a database that simply has name-value pairs. I'm willing to
> accept that I'm looking at the world the wrong way... what's the right way?
</SNIP>

-- 
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

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


Mime
View raw message