That's what I use when just outputting the contents of a bean; but I'm trying to format the data in form fields.
If I can't combine <html:text> and <bean:write> (or JSTL's <fmt:format>) tags, is there another way to achieve this? Thanks, -Sasha On 8/27/03 11:17, "Steve Raeburn" <[EMAIL PROTECTED]> wrote: > The Struts <bean:write> tag offers a format attribute (or formatKey if you > want to use a resource file). > But JSTL would be a better option if you can use it in your environment. > > Steve > > http://www.ninsky.com/struts/ > > > >> -----Original Message----- >> From: Sasha Borodin [mailto:[EMAIL PROTECTED] >> Sent: August 27, 2003 8:43 AM >> To: Struts Users Mailing List >> Subject: Formatting form data inside the *view* (JSP's) >> >> >> Thought I'd throw this out in the middle of the week again... >> >> Kind of a conceptual question: how do you format Dates, Numbers, >> Currencies, etc. for *form fields* inside the JSP? >> >> I know I could do in in the ActionForm getters, but: >> 1. I don't know the locate of the user at that point >> 2. I'd have to recompile the ActionForm every time I want to make a >> change to the *view* - seems like a bad practice. >> >> What I'm looking to achieve is something similar to <fmt:format> JSTL tag, >> where you can specify a format mask, or even a format "style" defined >> elsewhere. >> >> Thanks, >> >> -Sasha >> >> On 8/22/03 12:30, "Sasha Borodin" <[EMAIL PROTECTED]> wrote: >> >>> I would like to state a basic assumption I deduced in learning >> struts, then >>> pose a question. >>> >>> Assumption: ActionForm property getters and setters should >> return and take >>> Strings. >>> >>> My initial impulse was to try passing the actual data types >> (Dates, Numbers, >>> etc.); however, the Struts mechanism seems to pass Strings to >> the ActionForm >>> setter methods on form submission (which throws a conversion >> Exception of >>> course). Then I tried making the setters take Strings, and >> getters return >>> the actual data types, but this seemed to confuse the introspection >>> mechanism; plus I didn't see any way to apply formatting inside the >>> html:text tags (like you can in JSTL's fmt:format tags). >>> >>> Question: How does one handle formatting data (custom >> formatting or i18n) >>> for (pre/re)population of a form? >>> >>> Ex.: An update form; a user's information is loaded from the >> database into >>> classes (Strings, Dates, Numbers, etc.). If you want to format >> this data, >>> you have to do it in the Model, as the ActionForm only takes and gives >>> Strings - which seems to be a Bad Practice. Even if you had additional >>> special setters for the explicit purpose of populating the >> ActionForm from >>> original data types, you still don't know what Locale the >> client is from. >>> >>> Is my assumption incorrect? Is there a basic flaw in my >> understanding of >>> the use of ActionForm? Or there an actual short-coming, and workaround? >>> >>> In short, How Can You Format Data For Strut's Form Tags Inside >> The Actual >>> JSP :-) ? >>> >>> Thank you for any input. >>> >>> -Sasha >>> >>> >>> --------------------------------------------------------------------- >>> 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] >> >> >> > > > > --------------------------------------------------------------------- > 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]