<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %>

<%-- include file to make a button bar --%>
<table border='0' width='100%'>
  <tr>
    <td>
      <a href="<c:url value='/index.jsp'/>">Hogwarts Home</a>
    </td>

    <%-- is the user logged in? --%>
    <c:choose>
      <%-- logged in --%>
      <c:when test="${empty pageContext.request.userPrincipal}">
	<td align='right'>
	  <a href="<c:url value='/home.jsp'/>">login</a>
	</td>
      </c:when>

      <%-- not logged in --%>
      <c:otherwise>
	<td align='right'>
	  <a href="<c:url value='/home.jsp'/>">your homepage</a>
	</td>
	
	<td align='right'>
	  <a href="<c:url value='/logout.jsp'/>">logout</a>
	</td>
      </c:otherwise>
    </c:choose>

  </tr>
</table>
