#11 Problem with timestamp fields

open
nobody
None
5
2003-02-02
2003-02-02
Kenneth Stout
No

A timestamp field that is optional still generates an
error because the field is not in the correct format.
This is caused because the populate() method attempts
to convert the string field into the timestamp field,
and since the field is optional it may be blank.

There is code generated for each timestamp field
following the populate() method. This code, if were to
be executed, would suffer from the same problem, and
appears to be redundant.

Discussion

  • Logged In: NO

    Here is the solution:

    Please change the file <bin/template/struts-action.vm> as
    follows:

    line 265:
    form.set("$column.Name", ${util.firstLower
    ($bean.Name)}.get$util.firstUpper($column.Name)().toString
    ()); //DELETED EXTRA ")" at end!

    line 306:
    ${util.firstLower($bean.Name)}.set$util.firstUpper
    ($column.Name)(java.sql.Timestamp.valueOf(form.get
    ("$column.Name").toString() )); //use
    [get "myproperty"] instead. Also must convert to String!