Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/308.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 将spring模型列表显示为简单字段_Java_Forms_Spring_Jsp_Tags - Fatal编程技术网

Java 将spring模型列表显示为简单字段

Java 将spring模型列表显示为简单字段,java,forms,spring,jsp,tags,Java,Forms,Spring,Jsp,Tags,可以绑定字符串列表(List)并在组合框中的jsp中显示它们,如下所示: <form:select path="countryId"> <form:option value="" label="Please Select"></form:option> <form:options items="${countryList}" itemValue="countryId" itemLabel="countryName"/> </f

可以绑定字符串列表(List)并在组合框中的jsp中显示它们,如下所示:

<form:select path="countryId">
    <form:option value="" label="Please Select"></form:option>
    <form:options items="${countryList}" itemValue="countryId" itemLabel="countryName"/>
</form:select>
在JSP中,我使用

<c:forEach var="OutputsList" items="${Outputs}">  
    ${OutputsList}
</c:forEach>

${OutputsList}
但这份名单并没有打印出来。原因可能是什么?

那样做

<c:forEach var="country" items="${countryList}">
  <tr>
    <td>${country.countryId}</td>
    <td>${country.countryName}</td>
  </tr>
</c:forEach>

${country.countryId}
${country.countryName}
在服务器端使用ModelAndView对象

List<Country> countryList;
ModelAndView mv = new ModelAndView("index");
mv.addObject("country",countryList);
List countryList;
ModelAndView mv=新的ModelAndView(“索引”);
mv.addObject(“国家”,国家列表);
那样做

<c:forEach var="country" items="${countryList}">
  <tr>
    <td>${country.countryId}</td>
    <td>${country.countryName}</td>
  </tr>
</c:forEach>

${country.countryId}
${country.countryName}
在服务器端使用ModelAndView对象

List<Country> countryList;
ModelAndView mv = new ModelAndView("index");
mv.addObject("country",countryList);
List countryList;
ModelAndView mv=新的ModelAndView(“索引”);
mv.addObject(“国家”,国家列表);

在jsp中使用它时出现了错误的方法。从所讨论的代码中,只需交换输出列表

Map referenceData = new HashMap();
referenceData.put("OutputsList", Outputs);
在JSP中,我使用

<c:forEach var="OutputsList" items="${Outputs}">  
    ${OutputsList}
</c:forEach>

${item}

它将起作用。

在jsp中使用它时出现了错误的方法。从所讨论的代码中,只需交换输出列表

Map referenceData = new HashMap();
referenceData.put("OutputsList", Outputs);
在JSP中,我使用

<c:forEach var="OutputsList" items="${Outputs}">  
    ${OutputsList}
</c:forEach>

${item}

会有用的。

谢谢回复。我修改了我的问题。请再看一次,谢谢回复。我修改了我的问题。请再看一次。