The spring form controller (e.g. SimpleFormController or BaseCommandController ) uses commands to transfer data between the HTML form and the controller. My question is, is it common practice to use the support model as a team itself? Or, as a rule, a separate command is created with the appropriate attributes for those that are in the swap model.
My problem is that to use the support model as a command, property editors are needed to convert non-string attributes. Imagine a data model with many non-line strongly typed custom field types. When submitting a form, the property editor performs the conversion before invoking the validator. If type conversion is not possible (user input error), then the validator will never be able to provide a detailed error message. Everything that appears in HTML form is a generic error message. See my question https://stackoverflow.com/a/3188141/
An alternative is to create a separate command that duplicates each field in the backup model, but as a string. Thus, the validator can check the string representation of each field. The onSubmit controller is onSubmit responsible for converting the text command to the backup model. From my Spring research, this seems to be intended to be used. My desire to go this route is a cumbersome way that you need to create a separate command for each data model. Then added extra work that should march between the team and the data model. It is much more convenient to have a form directly editing the support model, and use the property editor to convert. Then the problem is validation.
So, I'm curious how others approach the editing problem based on model forms that contain custom non-line fields.
source share