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]

Reply via email to