見栄えのするパンくずリストを作成する必要があります。JSPで正常に動作する次のコードがあります。しかし、「absParent」などを取得するためにcurrentStyleオブジェクトで適切なメソッドを取得していないため、コードを見栄えのするものに変換するのに苦労しています。どんな助けでも大歓迎です!!
<%@ include file="/libs/foundation/global.jsp" %>
<%
final int startLevel = currentStyle.get("absParent", 3);
final int endLevel = currentPage.getDepth() - currentStyle.get("relParent", 0);
final int minItems = currentStyle.get("minItems", 2);
if (startLevel <= endLevel - minItems) {
%><section class="breadcrumbs"><%
for (int level = startLevel+1; level < endLevel; ++level) {
Page itemPage = currentPage.getAbsoluteParent(level);
if (itemPage == null || !itemPage.isValid() || itemPage.isHideInNav()) {
continue;
}
final String pagePath = itemPage.getPath() + ".html";
final String pageTitle = itemPage.getNavigationTitle();
String className = "breadcrumb-item-"+level;
if (level == startLevel) className += " breadcrumb-first";
if (level == endLevel-1) className += " breadcrumb-last";
pageContext.setAttribute("className", className);%>
<section class="breadcrumbs ">
<a href="<%= xssAPI.getValidHref(pagePath) %>" class="breadcrumb-item"><%= xssAPI.encodeForHTML(pageTitle) %></a>
</section>
<%} %>
</section><%
}
%>