[EMAIL PROTECTED] wrote:

> Hello all,
>
> after playing a while with struts i have a little question. Where is the
> best place to put the formating code for the data, e.g. to formate date
> and currency values. A special tag, the form bean + action class or the
> model beans ???.
>
> The example application contains no hints in this direction.
>

It will not make Struts 1.0, but my current thinking is that in 1.1 we'd add a
"format" attribute to the appropriate tags in struts-bean.tld and
struts-form.tld that would somehow define the appropriate formats, which would
be applied at runtime.  It may also prove necessary to create a repository of
TextFormat, DateFormat, and/or NumberFormat instances to be accessed via logical
names, so you can make global changes in the config file rather than modifying
every page that uses a particular format.

Besides rendering the output in an appropriate internationalized format, we also
need to worry about parsing the input and converting back to the underlying
native data type.

Using the PropertyEditor concepts from the JavaBeans specs may help us here.

>
> Any suggestion are welcome.
>

In the short term, I would probably add some read-only properties to your beans
that render the existing fields in the formats you wanted.  If you were
comfortable writing custom tags (they aren't that hard once you get the hang of
it :-), you might also experiment with writing a <format> tag for this purpose.


>
> bye
> Mario

Craig


Reply via email to