%@ page import="examples.Student"%> <%@ page import="examples.Address"%> <%@ page import="examples.Course"%> <%@ page import="java.util.*"%> <%@page contentType="text/html" %> <% Student mary = (Student)session.getAttribute("mary"); Address addr = (Address)mary.getAddress(); if( mary == null) { throw new RuntimeException("getAttribute(): null instance of Mary."); } Collection col = mary.getCourses(); if( col == null || col.size() == 0) { throw new RuntimeException("getAttribute(): null instance of Courses."); } Course first = null; first = (Course)col.iterator().next(); %>
Session ID (postfixed by jvmRoute in each node): <%=session.getId()%>
Mary's instructor is:
<%=first.getInstructor()%>
and zip code is:
<%=mary.getAddress().getZip()%>