Take a look at DisplayTag
(http://www.displaytag.org/example-grouping.jsp). It does grouping and
lots of other very cool things with tables.

Steve

> -----Original Message-----
> From: Jack Lauman [mailto:[EMAIL PROTECTED]
> Sent: May 8, 2004 10:27 AM
> To: Tag Libraries Users List
> Subject: JSTL Formatting Question
>
>
> I'm using the following jsp page to display tide tables.  How can I
> separate the days using the retrieved date field so the date only
> appears on the first line of the result set and only appears
> again when
> the date changes.  There are usually 6-7 lines of data for each day.
>
> I'd like to achieve something that looks like this:
>
> 2004-05-08    2:57    AM      7.27 feet       Low Tide
>               5:38    AM                      Sunrise
>               6:44    AM      8.45 feet       High Tide
>               2:43    PM      -2.81 feet      Low Tide
>               8:37    PM                      Sunset
>               10:55   PM      9.98 feet       High Tide
>
> 2004-05-09    4:13    AM      7.28 feet       Low Tide
>               5:36    AM                      Sunrise
>
> The page can be seen here:
> http://hood.nwcascades.com/tides/tidetest.jsp
>
>
> <--- code snip --->
>
> <fmt:setLocale value='en-US'/>
>
> <%-- Connect to MySQL using JBoss DataSource JNDI name --%>
>
> <sql:setDataSource
>      var="bbvtides"
>      dataSource="jdbc/BirchBayVillageDS"/>
>
>      <sql:query dataSource="${bbvtides}" var="result">
>       SELECT date, time, am_pm, height, cond
>       FROM cherry_point_tides
>       WHERE date BETWEEN CURDATE() and CURDATE() + INTERVAL 2 DAY
>      </sql:query>
>
> <%-- Display the tide table --%>
>
> <fmt:formatDate value='${now}' pattern="'Tide Table for 'EEEE', 'MMMM
> d', 'yyyy"/><br>
> Cherry Point, Birch Bay, Washington State<br>
> 48.8633&#176; N, 122.7583&#176; W - All times <fmt:formatDate
> value='${now}' pattern="zzzz' ('zz')'"/>
> <p><table border="1">
>      <tr>
>       <th>Date</th>
>       <th>Time</th>
>       <th>am/pm</th>
>       <th>Height</th>
>       <th>Condition</th>
>      </tr>
>
>      <c:forEach var="row" items="${result.rows}">
>      <tr>
>       <td><c:out value="${row.Date}"/></td>
>       <td><c:out value="${row.Time}"/></td>
>       <td><c:out value="${row.Am_Pm}"/></td>
>       <td><c:out value="${row.Height}"/></td>
>       <td><c:out value="${row.Cond}"/></td>
>      <tr>
>      </c:forEach>
> </table>
>
> <--- end code snip --->
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to