You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Edgar P Dollin <ed...@blue-moose.net> on 2003/09/29 15:09:50 UTC

View Logic which belongs in the Business Tier [was RE: Editable F ields V/S Static Text]

This is in answer to Craig's question a few days back about what kind of
business logic was needed in the tag classes.  

In my application there are quite a few classes of information that are
business logic requirements that without enhancing the tags would need view
code.  

1) The business logic should decide if a field is RW, RO or hidden to a
particular user in a particular part of the database.  This is way too much
logic for any view technology.  An example from my application is a Purchase
Order.  The clerk, can enter the order and the base fields including the
customer the material will be shipped to.  The manager can only enter the
approval field, so the customer is read-only to the manager.  The supplier
has access to the order, but can't necessarily (depending upon requirements
in the supplier configuration) see who the customer is so in this case the
customer is a hidden field or omitted from the html entirely.  

The easy argument to the above is this can all be done in JSTL or scriptlet
or to use multiple JSP/ActionForms/Actions one for each role.  In my mind,
this logic is too complex for scripts and the refactoring overhead of
removing it from java is too expensive.

2) Validation:  Currently the struts validator is very popular with good
reason.  However, this is creating a whole class of business logic in
separate files which are difficult to refactor, difficult to code complex
logic around, etc.  There should be an interface for the business logic to
implement to supply entry points for field validation.  

3) Basic information: Field sizes and types should be obtained from the
business tier, and not coded into the view with 'size and maxlength'.  Size
and maxlength should be rendered, but automatically based on information
from the business tier.

Edgar 

 

> -----Original Message-----
> From: Craig R. McClanahan [mailto:craigmcc@apache.org] 
> Sent: Friday, September 26, 2003 8:22 PM
> To: Struts Developers List
> Subject: Re: Editable Fields V/S Static Text
> 

> >3) Lastly, there are certain class of business information that the 
> >view needs, i.e. readonly, size.  The tags should have to ability to 
> >easily pass this information from the business tier to the view.  
> >Again, the hope of a submission relating to this type of extension 
> >being accepted seems iffy, especially since generalizing a specific 
> >implementation is a bit of effort.
> >  
> >
> I'd need to see a more detailed description of what you're thinking 
> about to know whether it would fit in, but I assume you're 
> talking about 
> something more than the "disabled" and "readonly" attributes that 
> already exist?
> 
> >Edgar
> >  
> >
> Craig
> 

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