You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by bill <bi...@gmail.com> on 2005/12/07 23:58:29 UTC

Struts Design Question

A bit of a struts newbie here. I have an application with the following page 
flow:
choose Product Category --> choose Product Model --> create/edit chosen model

Currently we only have one ActionForm\JSP Edit Form, but we need to expand 
this to support different Product Categories. Each would be a differnet set of 
attributes, so, probably, a differnt ActionForm\JSP combo.

Should we have a Forward per ProductCategory with a Product Category specific 
ActionForm and corresponding jsp?

Seems like there should be a better/more generic way. Any ideas?


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


Re: Struts Design Question

Posted by Ted Husted <te...@gmail.com>.
It sounds like WildCard mappings (since Struts 1.2) might help. You
would probably only need one set of mappings for any number of
catagories.

You would probably only need one ActionForm too. If some of the
categories don't use some of the properties, then they just travel
null. Just give the base form a different name (or extend it) to add
different validations.

If you are using DynaActionForms, and the categories share some
properties, in the upcoming Struts 1.3, you can use the new "extend"
attribute  to create a base DynaActionForm, and then add properties as
needed. To get a head start on Struts 1.3, see the nightly build.

For the server page, a popular technique would be to use a
DispatchAction and represent each product with its own dispatch
method. If the products share some fields, you could set a ActionForm
property to the dispatch method, and then use logic tags to include or
exclude fields for a particular product.

-- HTH, Ted.
http://www.husted.com/poe/

On 12/7/05, bill <bi...@gmail.com> wrote:
> A bit of a struts newbie here. I have an application with the following page
> flow:
> choose Product Category --> choose Product Model --> create/edit chosen model
>
> Currently we only have one ActionForm\JSP Edit Form, but we need to expand
> this to support different Product Categories. Each would be a differnet set of
> attributes, so, probably, a differnt ActionForm\JSP combo.
>
> Should we have a Forward per ProductCategory with a Product Category specific
> ActionForm and corresponding jsp?
>
> Seems like there should be a better/more generic way. Any ideas?

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