Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 我想使用foreach逐个显示hashmap数据?_Java - Fatal编程技术网

Java 我想使用foreach逐个显示hashmap数据?

Java 我想使用foreach逐个显示hashmap数据?,java,Java,我想显示一个hashmap,但是通过键和每个值一个td,而不是一个值中的整个批次?我的意思是: String getDescription = rs.getString("description"); int level = rs.getInt("level"); Timestamp startDate = rs.getTimestamp("startDateTime");

我想显示一个hashmap,但是通过键和每个值一个td,而不是一个值中的整个批次?我的意思是:

                    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);
                    putStartTime.add(less.startTime);
                    endTime.add(less.endTime);
                    List list = Arrays.asList(less.date.split("2010"));
                    for (int i = 0; i < list.size(); i++) {
                        putDates.add(list.get(i).toString());
                        Level.add(less.level);
                        LessonID.add(less.ID);
                        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);
//上面是bean代码

jstl:

      <c:forEach var="temp" items="${sessionScope.AvailableLessons['description']}">
                    <tbody>
                        <tr>
                            <form action="" method="POST">
                                <td>
                                    <c:out value="${temp}"/>

以下内容应足够:

一,。循环应该在表标记的外部,但在表标记的内部

二,。在每个环路内部,根据需要打开tr或td

<c:forEach var="myVar" items="${myMap}">
    ${myVar.key} ${myVar.value}
</c:forEach>

AkashKing您想每行或每列显示HashMap键,意思是每tr或每tdi想每td显示HashMap值是的,没错我尝试了以下方法: