I have an application used to track response times.  Essentially, an
event occurs and a database row is created with a Timestamp showing when
it occurred.  A "trouble sheet" is printed and the technicians take care
of the problem, filling in the sheet.

Once the sheet migrates back to the office the secretaries enter the
data on the sheet into a Struts2 web application.

The sheet is date-heavy, with fields such as:

1) time tech received the call
2) time the problem was resolved
3) time the tech got back to the office.

My application works fine, except that the Timestamp fields are rendered
as, well, ugly Timestamp fields which require the secretaries to follow
a specific format for data entry.

Some of our techs use 24-hour time format, some use 12-hour and in any
event the data entry is long.  I have written a DateFormatter class that
can be used to identify which format the secretary used and also to
allow them to enter only the times, using the date from the original
Timestamp as a reference.

My problem is how to get the Timestamp fields formatted properly before
display and then how to process the data that was entered to update the
Timestamp field in the database.

I'm guessing that I'll have to use String fields instead of Timestamp so
that I can control the formats and values in the .jsp.

My question concerns how to actually do this.   I've googled and have
the "Struts 2 Design and Programming" book and from what I can see, my
options look to be:

1) Use an interceptor both before and after to do the formatting.
2) Use the ModelDriven / Preparable interfaces to do the deed

or because I need to get data from a database prior to a display:

3) use Action chaining, getting the data first in one Action, then
chaining to another (armed with an interceptor) to do the formatting
both ways.

My questions are then:  "Which would be the most elegant means to this
end?" and "Can someone point me to example code?"

Thanks very much in advance.

Barry




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to