Dave Newton wrote the following on 7/12/2005 1:57 PM:
Rick Reumann wrote:

For what it's worth, I found a way I can get around passing my ActionForm to another layer, but in theory, I'm not convinced that doing so would really mean that I'd be breaking the seperation of components.


How so? If I have to include the Struts libraries to compile my business layer (like if I wrote a standalone/non-web client app or utility, which I do fairly frequently) or mock a Struts object to test the business layer then they're clearly not separated.

What I'm saying is adding another component that is called from your Action doesn't mean it's *automatically* the business layer. For example I have a UIHelper class that I use to get certain things from the request and session and to certain "View" like things. Just because it's called from an Action class doesn't mean it's the business layer.

Granted I can get around passing the ActionForm around, which I am going to do, but I still think if you just were passing it around to do 'struts/view specific' stuff it would not be wrong. For example, in Actions you see this...

//EmployeeUpdateAction
EmployeeForm empForm = (EmployeeForm )form;
Employee emp = new Employee ();
BeanUtils.copyProperties( emp, empForm )
employeeDAO.update( emp );

Granted this simple, and I often do like the above, but I don't see it as 'wrong' if instead you had....

//EmployeeUpdateAction
employeeUIHelper.update( form );

The UIHelpers would do just like I did in the Action above. A waste, maybe so, but I wouldn't say it's wrong. In theory I'd even argue it's more 'correct' to do the above since the concept is that Actions are to act mostly as controllers - handling flow. In the scenario above some of the *view* business is now moved to another area. (I'll admit I don't do this because I'm lazy and don't feel like creating the extra classes, but I think it's a clean approach).

The EmployeeUIHelper would just do some stuff you'd tyically do in your Action anyway.

--
Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to