<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" language="java" %> <%@ page import="org.springframework.web.util.HtmlUtils" %> <%@ page import="com.pandoli365.bibimbap.data.PostData" %> <%@ page import="com.pandoli365.bibimbap.data.PostCategoryData" %> <%@ page import="java.net.URLEncoder" %> <%@ page import="java.time.OffsetDateTime" %> <%@ page import="java.util.Collections" %> <%@ page import="java.util.List" %> <% String ctx = request.getContextPath(); List posts = Collections.emptyList(); Object postsAttr = request.getAttribute("posts"); if (postsAttr instanceof List) { posts = (List) postsAttr; } List categories = Collections.emptyList(); Object categoriesAttr = request.getAttribute("categories"); if (categoriesAttr instanceof List) { categories = (List) categoriesAttr; } Long categoryId = (Long) request.getAttribute("categoryId"); boolean hasNext = Boolean.TRUE.equals(request.getAttribute("hasNext")); boolean canWrite = Boolean.TRUE.equals(request.getAttribute("canWrite")); OffsetDateTime nextCursorCreatedAt = (OffsetDateTime) request.getAttribute("nextCursorCreatedAt"); Long nextCursorId = (Long) request.getAttribute("nextCursorId"); %> 포스팅 | bibimbap

POSTING

포스팅

<% if (canWrite) { %> 글쓰기 <% } %>
<% if (posts.isEmpty()) { %> <%@ include file="fragments/posts-empty.jspf" %> <% } else { %>
<% for (PostData post : posts) { %> <% if (post.getOgImageUrl() != null && !post.getOgImageUrl().isBlank()) { %> <% } %>
<% if (post.getCategoryName() != null && !post.getCategoryName().isBlank()) { %> <%= HtmlUtils.htmlEscape(post.getCategoryName()) %> <% } %>

<%= HtmlUtils.htmlEscape(post.getTitle() == null ? "" : post.getTitle()) %>

<%= HtmlUtils.htmlEscape(post.getAuthorDisplayName() == null ? "" : post.getAuthorDisplayName()) %>
<% } %>
<% if (hasNext) { StringBuilder moreUrl = new StringBuilder(ctx).append("/posts?"); moreUrl.append("cursorCreatedAt=").append(URLEncoder.encode(String.valueOf(nextCursorCreatedAt), "UTF-8")); moreUrl.append("&cursorId=").append(nextCursorId); if (categoryId != null) { moreUrl.append("&categoryId=").append(categoryId); } %> 더보기 <% } %> <% } %>