Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/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
Jsp 在单独的输入中显示列表元素_Jsp_Spring Mvc_Jstl - Fatal编程技术网

Jsp 在单独的输入中显示列表元素

Jsp 在单独的输入中显示列表元素,jsp,spring-mvc,jstl,Jsp,Spring Mvc,Jstl,我正在尝试在JSP中打印字符串列表。我的控制器中有: List<String> profileNames = new Vector<String>(); ... modelMap.addAttribute("pn", profileNames); List profileNames=new Vector(); ... addAttribute(“pn”,profilename); 在我的JSP中: <c:forEach var="p" items="${pn}"

我正在尝试在JSP中打印字符串列表。我的控制器中有:

List<String> profileNames = new Vector<String>();
...
modelMap.addAttribute("pn", profileNames);
List profileNames=new Vector();
...
addAttribute(“pn”,profilename);
在我的JSP中:

<c:forEach var="p" items="${pn}" varStatus="rIndex">
    <input type="text" value="${pn}"/>
</c:forEach>

通过这样做,每个输入框由列表中的所有元素填充


但是,我需要将列表中的每一项放在一个单独的输入框中,类似于
${pn.get(index)}
。我怎样才能做到这一点?

您的方法很好,但输入值输入错误

替换此项:

<input type="text" value="${pn}" />

为此:

<input type="text" value="${p}" />