I'm pretty new to Java and I apologize in advance if I'm wording this incorrectly. I've got a small code snippet that has multiple opening and closing delimiters because I've got some HTML mixed with JSP. Without the HTML this can be done in just a few lines of code but I need the HTML to render and it leads to almost double the lines of code. I'm wondering if there is a better way to do this as opposed to having so many opening and closing delimiters. I know I can use a templating library but I'm trying to stay away from that and would like if at all possible to do this inside a JSP (not a separate class). Thanks for the help!
<%
try {
List<Page> children = properties.getPath("getChild", "");
%>
<ul>
<%
for (Page children : e) {
if (children != null) {
%>
<li><a href="#">Show a link</a></li>
<%
}//end if statement
}//end for loop
%>
<li><a href="<%= currentPage.getPath() %>" href="<%= currentPage.getPath() %>">Another link goes here</a></li>
</ul>
<%
} catch (NullPointerException e){
%>
//show some content here
<% } %>