out.println("<div class=\"links\"><a href=\"CreateBlogEntryForm\">Create New Post</a> <a href=\"EditAuthorForm\">Create Author</a></div>");
Date currentDate = null;
for (int i = 0; posts.hasNext(); i++) {
BlogEntry post = posts.next();
if (doesNotMatch(post.getPublishDate(), currentDate)) {
currentDate = post.getPublishDate();
out.print("<div class=\"postDate\">");
//out.print(DateFormat.getDateInstance(DateFormat.FULL).format(currentDate));
if (currentDate != null) {
out.print(DateFormat.getDateInstance(DateFormat.FULL).format(currentDate));
}
out.println("</div>");
}
out.print("\t\t<div class=\"post\" id=\"");
out.print(i);
out.println("\">");
out.print("\t\t\t<div class=\"postTitle\">");
out.print(post.getTitle());
out.print("</div>");
out.print("\t\t\t<div class=\"postBody\">");
out.print(post.getBody());
out.println("</div>");
out.print("\t\t\t<div class=\"postAuthor\"><a href=\"ViewAuthor?email=");
out.print(post.getAuthorEmail());
out.print("\">");
out.print(post.getAuthor().getFullName());
out.println("</a></div>");
if (service.isCommentingAvailable()) {
out.print("<div class=\"links\"><a href=\"AddCommentForm?postId=");
out.print(post.getId());
out.print("\">Add Comment</a></div>");
List<? extends BlogComment> comments = service
.getCommentsForEntry(post);
int size = comments.size();
out.print("<div class=\"commentTitle\"");
if (size > 0) {
out.print("onclick=\"expand(");
out.print(post.getId());
out.print(")\"");
}
out.print(" style=\"cursor: pointer;\">Comments (");
out.print(size);
out.println(")</div>");
if (size > 0) {
out.print("<div id=\"comments");
out.print(post.getId());
out.println("\">");
for (BlogComment comment : comments) {
out.println("<div class=\"comment\">");