Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/19.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
Struts 1 使用struts1中的optionCollection标记填充值_Struts 1 - Fatal编程技术网

Struts 1 使用struts1中的optionCollection标记填充值

Struts 1 使用struts1中的optionCollection标记填充值,struts-1,Struts 1,我有一个arraylist,其中包含{1,2,3,4,5}作为对象。我想在下拉选择框中显示这些值。我如何实现它。如何使用值和标签属性进行映射 <% for (int j = 0; j < arrayNew.size(); j++) { %> <% if ("dropDown") { %> <% if (counter == 0) {

我有一个arraylist,其中包含{1,2,3,4,5}作为对象。我想在下拉选择框中显示这些值。我如何实现它。如何使用值和标签属性进行映射

    <%
    for (int j = 0; j < arrayNew.size(); j++) {
    %>

        <%
            if ("dropDown") {
        %>
        <%
        if (counter == 0) {
        %>
        <select name="serveyTakerValue">
            <%
                counter++;
            }
            %>
                 <option value=<%=arrayNew.get(j)%>><%=arrayNew.get(j)%></option>

            <%
                }
            %>
 <%
  }
  counter = 0;
 %>
       </select><br><br>
试试这个可以解决你的问题。 注意:并且必须调用一次。这就是为什么在这段代码中使用计数器的原因。假设arrayNew是您的ArrayList