You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dan Allen <da...@mojavelinux.com> on 2003/03/10 07:47:06 UTC

hangout form with tiles as solution

A solution is included below for review:

I am designing a site where this one form sits on every page in a
tile which contains several fields which must be populated with
data.  Naturally it would be poor design to consider this form in
every single Action on the site, so I quickly discounted that
solution.  Next I considered putting the form data in the session,
but again, the problem becomes determining which page to handle
adding the data to the session, as a website has many entrance
points (unlike a desktop program).  Finally, I concluded that I
could use tiles to my advantage and it solves quite nicely the
problem of multiple (possibility unreleted) forms on a page.  So
without further ado, please comment on my tiles solution:

Assuming that your page will have several, often unrelated forms due
to the tile-like makeup of webpages, your solution might be to
leverage the tiles plugin from struts to handle these forms.
Consider the case where the form is placed into a tile of its own,
whether it be a sideblock or the main content.

Normally, when preparing a page with a single form, you might make
the request an action mapped to an Action class and then forward to
the view page, so that you may populate the form in the Action
before viewing it.  However, with multiple forms on a page, this
get's to be pretty complicated, especially if you are mixing and
matching forms.

Enter the Tiles Controller Action.  This action comes with the tiles
package and is named org.apache.struts.tiles.actions.TilesAction.
In short, instead of having one action per view, you can have as
many as one action per tile.  Therefore, when you call up a tile
with a form, instead of worrying about having an Action for the page
which includes these tiles, the Action is focused on one particular
tile.  This is ideal since tiles which are adjacent don't
nececesarily relate to each other. (Please note that you will still
have an Action for each page, but those actions will be related to
the general workflow and not as much the form preperation).

I could include an example, but Cedric already did on page 15 of the
tiles pdf documentation.  I just skipped it the first time I read it
because I didn't understand why a tile would need a controller.  Now
I am golden.

What this leads to is "just in time" preperation for your forms, in
case they are included on a page which did not come from an action
or came from an unrelated action.

I would love to discuss the integration of this technique and now
that I have dicovered it I truly believe it warrants an article all
on its own.

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, <da...@mojavelinux.com>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
"The package said 'Windows 95 or better', so I installed Linux"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

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