The following markup can be used to display the Session ID.
<c:out value="${pageContext.session.id}"/>
The following choose / when / otherwise statement can be used to do something based on whether or not there is a session ID.
<c:choose>
<c:when test="${not empty pageContext.session.id}">
Your session ID number is <c:out value="${pageContext.session.id}"/>
</c:when>
<c:otherwise>
Sorry. There is no session ID.
</c:otherwise>
</c:choose>