<!-- This is my latest init.jsp for all JSP files -->
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
<%@ page import="com.liferay.portal.model.Layout"%>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList"%>
<%@ page import="javax.portlet.PortletPreferences" %>
<%@ page import="com.liferay.portal.kernel.util.StringPool" %>
<%@ page import="com.liferay.portal.theme.ThemeDisplay"%>
<%@ page import="com.liferay.portal.kernel.util.Constants" %>
<%@ page import="com.liferay.portal.kernel.util.GetterUtil" %>
<%@ page import="com.liferay.portal.service.LayoutLocalServiceUtil" %>
<%@ page import="com.liferay.portal.service.ResourceActionLocalServiceUtil" %>
<%@ page import="com.liferay.portal.model.LayoutConstants" %>
<portlet:defineObjects />
<liferay-theme:defineObjects />
<!-- How to get the themedisplay object in JSP --->
Use imports above
Instance ID <%= themeDisplay.getPortletDisplay().getInstanceId() %><br>
Id <%= themeDisplay.getPortletDisplay().getId() %><br>
Name <%= themeDisplay.getPortletDisplay().getPortletName() %><br>
<!-- How to iterate over the layouts -->
long rootLayoutId = LayoutConstants.DEFAULT_PARENT_LAYOUT_ID;
List<Layout> rootLayouts = LayoutLocalServiceUtil.getLayouts(layout.getGroupId(), layout.isPrivateLayout(), rootLayoutId);
long groupId = themeDisplay.getLayout().getGroupId();
String friendlyUrl = themeDisplay.getLayout().getFriendlyURL();
List<Layout> l2 = LayoutLocalServiceUtil.getLayouts( groupId, false);
for (Layout pageProperties : l2)
{
%>
<%= pageProperties.getFriendlyURL() %>
<%
}
<!-- Improving the Default Message Board Email Notifications -->
<b>Dear User, <br><br>
[$MESSAGE_USER_NAME$] ( [$MESSAGE_USER_ADDRESS$] ) has added a new message. <br><br></b>
<blockquote><i>[$MESSAGE_BODY$]</i></blockquote>
<!--- generate your own child page sitemap -->
<%
String showLocationAddress_view = portletPreferences.getValue("showLocationAddress", "String");
long groupId = themeDisplay.getLayout().getGroupId();
String friendlyUrl = themeDisplay.getLayout().getFriendlyURL();
long rootLayoutId = LayoutConstants.DEFAULT_PARENT_LAYOUT_ID;
long layoutId = LayoutConstants.DEFAULT_PLID;
String typeUrl = LayoutConstants.TYPE_URL;
List<Layout> rootLayouts = LayoutLocalServiceUtil.getLayouts(layout.getGroupId(), layout.isPrivateLayout());
List<Layout> layouts55 = themeDisplay.getLayout().getAllChildren();
%>
rootlayoutid <%= rootLayoutId %><br>
layoutid <%= layoutId %> <br>
typeurl <%= typeUrl %> <br>
locale = <%= themeDisplay.getLocale() %><br>
size: = <%= layouts55.size() %><br>
<ul>
<%
for (Layout layout1 : layouts55 )
{
%>
<li><a href="/web/<%= groupId %>/<%= layout1.getFriendlyURL() %>"><%= layout1.getName() %></a></li>
<%
}
%></ul><%