首页 > 解决方案 > 我无法在下拉列表中显示列表值,该列表值作为列表从我的 JSP 中的 java 类传递。如果我使用表,我的代码可以完美运行

问题描述

我从我的 JSP 中的 java 类传递列表,我想在下拉列表中显示列表值。在调试时,我检查了该列表是否包含所需的值,但未显示在我的 JSP 下拉列表中。虽然如果我以表格形式显示这些值就会出现。

请告诉我哪里出错了,我怎样才能让我的代码工作?

Java 代码:

    // add the event list to the model
    theModel.addAttribute("event", theEvents);
    return "fundContributionCollectionListPage";

JSP 代码:

    <select name="eventSelected">
    <c:forEach var="tempEvents" items="${event}">
      <option value="tempEvents.eventName">${tempEvents.eventName}</option>
    </c:forEach>
    </select> 

标签: javajspjstl

解决方案


推荐阅读