title: How do i display the contents of a hashmap via the string key?
body: <p>I have tried .key and .value but i dont get what i want, i want to display the contents of the hashmap but via the key only. here is the source:
  Bean: </p>
  
  <p>public class LessonTimetable implements Serializable {</p>
  
  <pre><code>private Connection connection = null;
  private ResultSet rs = null;
  private PreparedStatement st = null;
  private Map lessons = new HashMap&lt;String, List&lt;Lesson&gt;&gt;();
  private DataSource ds = null;
  public Lesson less;
  
  
  public LessonTimetable() {
      // You don't need to make any changes to the try/catch code below
      try {
          // Obtain our environment naming context
          Context initCtx = new InitialContext();
          Context envCtx = (Context) initCtx.lookup("java:comp/env");
          // Look up our data source
          ds = (DataSource) envCtx.lookup("jdbc/LessonDatabase");//change to LessonDatabase..will also have to setup credentials for my virtualmin server account.
      } catch (Exception e) {
          System.out.println("Exception message is " + e.getMessage());
      }
      try {
          // Connect to the database - you can use this connection to 
          // create and prepare statements, and you don't need to worry about closing it
          //String username = "root";
          //String Password = "";
          Class.forName("com.mysql.jdbc.Driver");
          connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "");//test locally first
          try {
              if (connection != null) {
                  // TODO instantiate and populate the 'lessons' HashMap by selecting the relevant infromation from the database
                  List&lt;String&gt; putDescriptions = new ArrayList&lt;String&gt;();
                  List&lt;String&gt; putDates = new ArrayList&lt;String&gt;();
                  List&lt;String&gt; putStartTime = new ArrayList&lt;String&gt;();
                  List&lt;Integer&gt; Level = new ArrayList&lt;Integer&gt;();
                  List&lt;String&gt; LessonID = new ArrayList&lt;String&gt;();
                  List&lt;String&gt; endTime = new ArrayList&lt;String&gt;();
                  String query = String.format("SELECT description,level,startDateTime,endDateTime,lessonid FROM LESSONS");
                  st = connection.prepareStatement(query);
                  rs = st.executeQuery();
                  connection.setAutoCommit(false);
                  st.setFetchSize(0);
                  while (rs.next()) {
                      String getDescription = rs.getString("description");
                      int level = rs.getInt("level");
                      Timestamp startDate = rs.getTimestamp("startDateTime");
                      Timestamp endDate = rs.getTimestamp("endDateTime");
                      String LessonId = rs.getString("lessonid");
                      this.less = new Lesson(getDescription, startDate, endDate, level, LessonId);
                      putDescriptions.add(less.description);
                      putDates.add(less.date);
                      putStartTime.add(less.startTime);
                      Level.add(less.level);
                      LessonID.add(less.ID);
                      endTime.add(less.endTime);
                      this.lessons.put("description", putDescriptions);
                      this.lessons.put("StartDate", putDates);
                      this.lessons.put("StartTime", putStartTime);
                      this.lessons.put("EndTime", endTime);
                      this.lessons.put("Level",Level);
                      this.lessons.put("LessonID", LessonID);
                  }
                  rs.close();
                  st.close();
              }
          } catch (Exception e) {
              System.out.println("Exception is ;" + e + ": message is " + e.getMessage());
          }
      } catch (Exception e) {
          System.out.println("Exception is ;" + e + ": message is " + e.getMessage());
      }
  }
  
  /**
   * @param ItemID
   * @return the items
   */
  public Lesson getLesson(String ItemID) {
      return (Lesson) this.lessons.get(ItemID);
  }
  
  public Map getLessons() {
      return this.lessons;
  }
  </code></pre>
  
  <p>}</p>
  
  <pre><code>  session.setAttribute("AvailableLessons", availableLessons.getLessons());
                     &lt;c:forEach var="hash" items="${sessionScope.AvailableLessons}"&gt;
                      &lt;tbody&gt;
                          &lt;tr&gt;
                              &lt;form action="" method="POST"&gt;
                                  &lt;td&gt;
                                      &lt;c:out value="${hash.key['description']}"/&gt; throws a  PropertyNotFoundException
                                  &lt;/td&gt;
  </code></pre>