It's generally helpful to think of the Struts-config as your API. Each
logical mapping represents a task that your application can perform.
Some mappings may share Actions, but, later, if you decide you need a
separate Action for a task, you can make that change within your
struts-config, without touching any other JSP or Java code. Likewise, if
you have different Actions and later combine them into one, you can make
that change just by updating your struts-config. Nothing else needs to
change.

If each component has its own mapping, then it is also very easy to
select which view the component uses -- just give each mapping its own
local forward to a different JSP. Internally, they can all forward to
"continue" or "success", and keep all the JSP paths in your
struts-config (where they belong).

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel +1 716 737-3463
-- http://www.husted.com/struts/


Fabien Modoux wrote:
> 
> Hello,
> 
> I have an action (e.g., browse items) that will be
> used by several components of my system. The logic
> and mappings for browsing items are common to all
> components, but the actual view (JSP used) will be
> specific to each component.
> I am not sure it is would be better to have one mapping
> of the "BrowseItems" action for each component, or
> have one single mapping which takes an additional
> argument identifying the current component using it.
> I think the latter will be easier to maintain, as I
> will not have to replicate the action mapping and
> its forwards in the struts-config for each component
> (e.g., if there is a new feature available when browsing
> items, I will have to add it to all mappings). On the
> other side, with the former, I need to keep track of the
> current component and have a (implicit) mechanism to
> map views to actual files.
> 
> Anyone has any experience or advice about this case?
> 
> Thanks,
> 
> -Fabien
> 
> ---------------------------------------------
> Fabien Modoux,
> Voicemate - http://www.voicemate.com

Reply via email to