Can someone elaborate on this? I'll offer a virtual beer after normal work hours.
-----Original Message----- From: Givler, Eric [mailto:[EMAIL PROTECTED] Sent: Friday, August 18, 2006 11:59 AM To: user@struts.apache.org Subject: Formatting data for display and parsing to save I don't know why, but I've been wondering how to handle the issue of presenting formatted data to a user in a struts-based application. That is, is it: 1. Backend bean is strongly typed and data is read into this via Service method of some sort 2. Action takes backend data and through a helper object formats it and places into ActionForm properties as formatted values 3. User enters data 4. Validation ensures formatting is ok (Struts Validator or other) 5. If ok, helper object parses results and creates business bean (DTO) to persist to back end 6. Invoke service method to store it I've looked at FormDef, but the App I've inherited to fix contains a lot of front-end code (in JSP) that adds up values and presents them. Now that the form bean (a map) contains all Strings, I have to then run <fmt:parse> against all of this data to add it up. I guess I could add it up in the Action when I first read the database values and created some other request attributes, and made sure these attributes were refreshed if I hit save. If validation occurs and errors are thrown, where do I get those database values again to add easily? I can't add the unparse-able numbers (or I add them as zero) Do I throw the DTO into the form bean as a property? I'm not sure I like the idea that the Business bean returns the formatted data, which I've seen in Struts In Action. Not that I have anything against the book, but if the formatting is based on a Locale, and a locale is user-based, then it seems like the formatting should be occurring in the front-end like in JSF, rather than the other way around. Also, is there something that works for multi-record entry with formatting as well? I didn't understand how form-def was supposed to handle this, and the same issue would apply with summing the result records (actually sum, min, and max) I'm all ears for suggestions, and thanks. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]