spring - Where to format non-standardized data into a standard format (View, Service, or DAO layer)? -


i using spring mvc presentation layer, , using spring service , dao layers. format data in view layer of mvc (in case jsps), if data retrieved database not in standardized format?

for instance, pulling phone numbers 1 of company's databases, potentially in format (111)-555-1234 or 1115551234, etc. seems functionality , processing place in jsp/view layer. prefer put of numbers in same format somewhere else , re-format on view. should format in situation - service layer? dao?

this allow me take advantage of libraries not potentially call jsp (or not make sense call jsp).

thanks!

i have dao query methods remove formatting characters phone numbers, , have presentation layer give them consistent format (probably in jsp tags). not fan of putting business logic in daos, seems extremely data-related.

(actually if formatting code first removes pre-existing formatting before doing own formatting, might able without removing formatting characters anywhere else. having things in canonical form.)

as alternative putting formatting-char-removal in dao, if using hibernate can create custom user types remove or insert formatting characters phone number attributes.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -