Results 1 to 3 of 3
Thread: Listing info by date
- 08-06-2009, 04:51 PM #1
Member
- Join Date
- Aug 2009
- Posts
- 2
- Rep Power
- 0
Listing info by date
Hi. I am trying to loop over data from my db to produce a listing and header similar to craigslist posting.
I need to display all items listed for date "such and such" and then go to the next previous date and do the same thing.
This produces a listing but shows the date every time. How can I just show the date once (formatted as a heading) , list all the items listed on that date, and then move onto the next previous date and list all items on that day, and continue on till 30 days from today are listed. Again, a craigslist listing is similar to what I am looking for.Java Code:<sql:query var="listall" dataSource="jdbc/PPOefab" > SELECT * FROM gmlistmain ORDER BY datePosted ASC </sql:query> <jsp:useBean id="current" class="java.util.Date"/> <fmt:formatDate var="dateFormatted" value="${current}" type="both"/> <c:out value="${dateFormatted}"/> <table width="88%" border="0" cellpadding="10" cellspacing="10"> <c:forEach items="${listall.rows}" var="listallRows"> <tr> <td > ${listallRows.datePosted}</td> <td> <a href="detail.jsp?recordID=${listallRows.posting_ID}">${listallRows.postingTitle}</a> ( ${listallRows.location} ) </td> <td> ${listallRows.postingDescription} </td> </tr> </c:forEach> </table>
I know I will need to loop over, but I am not able to figure this out. Any help would be appreciated.
- 08-07-2009, 04:34 AM #2
Senior Member
- Join Date
- Dec 2008
- Location
- Hong Kong
- Posts
- 473
- Rep Power
- 5
c:set var="tmp" value="0"
compare the date and tmp variable, if they have differences, display the date and update tmp variable to valud of date
- 08-07-2009, 03:03 PM #3
Member
- Join Date
- Aug 2009
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
Compare date input to database with current date
By hungleon88 in forum Advanced JavaReplies: 2Last Post: 11-25-2008, 08:10 AM -
Creating a Gregorian Calendar using a Date object gives date - 1
By prachi_goliwadekar in forum New To JavaReplies: 1Last Post: 05-08-2008, 08:32 PM -
Difference between current date and anothe date
By vijay balusamy in forum New To JavaReplies: 1Last Post: 04-16-2008, 04:15 PM -
Listing all threads and threadgroups in the VM
By Java Tip in forum java.langReplies: 0Last Post: 04-09-2008, 06:36 PM -
Listing all available Locales
By Java Tip in forum Java TipReplies: 0Last Post: 12-29-2007, 04:54 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks