Hey guys, I have an MVC-type question. My View captures data from the user
and sends it to the Controller, which validates and massages it and uses it
to configure the Model and tell the Model to do something. Based on the
something, the Controller sends another View to the client. So far so good.

What happens when something, or rather, somethings go wrong when the Model
is doing its work? How should the Model communicate this to the Controller
in a way that doesn't violate the seperation of concerns? Currently, my
Model creates a struts ActionErrors object and puts the error messages into
it and returns it to the Controller. This strikes me as a bad design choice
because the Model object shouldn't have any notion of the environment in
which it lives. However, I'm unsure what the best practice is. Choices
include:

* Tossing an exception - but I would like to be able to send multiple
errors at the same time

* Return a List or array of String error messages - but then my messages
are hard-coded into the application, making i18n painful. I could make the
Strings returned be keys into the ApplicationResources properties file, but
then how do I attach parameters for messages that need them?

* Return, oh, a SortedMap of error messages, where the keys are the error
message keys, sorted in order of occurance, and the values are Lists of
parameters for the error messages - but this seems awfully convoluted.

Any suggestions?

- donald


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

Reply via email to