struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Graham" <>
Subject Re: Why not just use Request.getParameterMap() ?
Date Fri, 23 May 2003 13:45:20 GMT
>Personally, I've found that once you've started to use a business facade, 
>there's a good case of using a data-entry facade object to go with it. So, 
>I define a business interface to represent a facade's data-transfer (or 
>"helper") object. I then implement that interface as an ActionForm. This 
>way you can pass the ActionForm directly to the facade (under its 
>interface). For unit tests, I write the tests against the helper interface, 
>but use the ActionForm implementation.

How do you deal with the form properties being Strings and your business 
objects using more appropriate data types like int?  Do you make a 
conversion somewhere?


>So, for the price of a few extra accessors, you can safely eliminate 
>duplication and eliminate dependency (Beck's Golden Rule).
>HTH, Ted.
>Mike Whittaker wrote:
>>>There are some decent designs to keep down the amount of duplicate 
>>>you need.
>>>1) You can place you model objects into your form and then use nested
>>>properties ( to set/get them.  It works well for 
>>>(though probably wouldn't work very nicely for URL parameters).  That way
>>>you action class can just pull the fully created model object out of the
>>>form and pass it off to the business layer.
>>But the form is supposed to represent user input alone.
>>If you ship it to Model layer then change it (eg sql escapeing)...
>>Or is this only applicable before validation, after it can't possibly get
>>back to the view??
>>But what about session forms?
>>>2) Have you business layer expect interfaces (instead of objects)
>>>which have
>>>no presentation ties.  Have you ActionForm implement that interface.  
>>>passing your action form to the business layer isn't so bad.  You 
>>>layer has no clue that there are presentation related functionality in 
>>>model interface coming back to it.
>>Then you have to have an interface for virtually every form.  More
>>What if you have (more or less) just one form for your entire app?  Then 
>>can have one interface.  Still doesn't answer the concerns with 1) above
>>Mike W.
>Ted Husted,
>Struts in Action <>
>To unsubscribe, e-mail:
>For additional commands, e-mail:

Add photos to your messages with MSN 8. Get 2 months FREE*.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message