Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

RE: select - format date

Bruno Melloni

2007-02-20

Replies:

There probably is a better "struts" way of doing this, but here is one
way that gets the job done:

- Use a list of string-formatted datetimes. Format the dates before
putting them on the list.

- For formatting, review the classes java.util.Date, java.util.Calendar,
java.text.DateFormat, java.text.SimpleDateFormat. Use appropriately.

B.

-----Original Message-----
From: ros [mailto:ros@(protected)]
Sent: Tuesday, February 20, 2007 5:32 AM
To: user@(protected)
Subject: s:select - format date


Hi!

Using Struts2
<s:select id="reservationId" key="ticket.select"
list="purchase.event.reservations" listKey="id"
                   listValue="dateTime+' '+price" /> has
output:
<select name="ticket.select" id="reservationId">
  <option value="2">2009-09-27 00:00:00.0 0.01</option>
  <option value="1">2009-09-27 00:00:00.0 null</option> </select>

How to set dateTime (java.util.Date) format? (e.g. to show only date)
How hide null values, if price is null?

Thanks!
--
http://www.nabble.com/s%3Aselect---format-date-tf3259859.html#a9060019
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.