I'm sure this has been talked about many times, but I couldn't find a succinct discussion about this in the archives.
The question is, what are the best, or common, practices with respect to where and how validation and conversion is done between "view" values and "model" values, and with date/phone values, in particular? In my particular context, I'm not interested in how the Validator framework should fit into this, only because the consensus opinion in my team was to not use the Validator framework at this time (because they wanted to reduce training/information overload). I ask this partly to review the principles for myself, but also to get information to back up my views on this in my team. In my opinion, the form bean value should contain exactly the string that is displayed in the browser. The business logic layer, however, should contain the value as it is represented in the domain layer, being a Date value or a ten character numeric string (for a phone number). The stickier question is where the conversion and validation is done, and what layer "owns" the algorithms for this. I think it's a good idea to have the form bean "own" the conversion algorithms (define the from/to code in form bean methods), but drive the validation process in the Action. However, I believe there are different opinions on this. I've heard that there are some people who believe the formatting and format validation should be done in the business logic (below the Action), which I find hard to believe. With respect to phone numbers, there's some question about whether it's better to provide a single text field to enter a phone number, or to have three fields for the three pieces of the number. If the single field is used, then the value stored in the form bean would be like "(nnn) nnn-nnnn" (if you assume that the form bean stores exactly what is displayed on the screen), and you use javascript on "blur" to convert an entered ten-digit string to the proper format. If three fields are used, the formatting is a little easier, and the only javascript (if at all) is to set focus to the next field when the field fills up (so they can enter ten digits consecutively without stopping). I'd appreciate people's carefully crafted opinions on this, and any useful references. -- To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>