Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.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 值未出现在下拉列表中_Java_Spring - Fatal编程技术网

Java 值未出现在下拉列表中

Java 值未出现在下拉列表中,java,spring,Java,Spring,我的web应用程序中有一个问题,下面的代码是我为整个应用程序编写的,它运行良好。但在本例中不是这样。 我在JSTL中使用了正确的变量名,我的查询也运行良好,并生成了我想要的结果,但这些值仍然没有出现在下拉列表中。。我甚至想不出来 有人能帮我解决这个问题吗 <td> <span id="store_${i}"></span> <f:select class="form-control" path="boqList[${i}].organi

我的web应用程序中有一个问题,下面的代码是我为整个应用程序编写的,它运行良好。但在本例中不是这样。 我在JSTL中使用了正确的变量名,我的查询也运行良好,并生成了我想要的结果,但这些值仍然没有出现在下拉列表中。。我甚至想不出来

有人能帮我解决这个问题吗

<td>
    <span id="store_${i}"></span>
    <f:select class="form-control"  path="boqList[${i}].organizationCode" id="storeId${i}"                                      onchange="chekeAvailibiltyAtStore(this.value,'${b.itemCode}','${b.itemUnit}','${i}')" required="true"> 
        <f:option value="">Select Area Store</f:option>
        <c:forEach  items="${areaStors}" var="as" >
            <f:option value="${as.organizationCode}">${as.organizationName}</f:option>
        </c:forEach>
    </f:select>
</td>
内部服务(查询工作罚款)

请参见下面的屏幕截图

在JSP的开头添加。这是一个简单的测试,
areaStors
列表是否存在。例如:


选择区域存储
${as.organizationName}

代码看起来正常。尝试调试,验证它是否与您在JSP中填充并在UI上检查的下拉列表相同。还要在JSP的开头添加
,以确保列表正确地从控制器传递到JSP页面处理器。如果传递了
areaStors
,则此语句不应影响您的应用程序逻辑,否则您将在页面加载时看到异常。@请naXa在我现有的代码中提供您建议的实现,谢谢很好的一个…我真的不知道它将如何工作…bcz我在我的项目中第一次使用了你的代码片段,其余的发布代码在其他地方也可以正常工作,但是是什么让这个页面如此特别…任何方式都非常感谢much@Zia它解决了你的问题吗?下拉列表中现在有值了吗?是的。。。我不知道…但是我是怎么得到我预期的结果的,非常感谢naxa
mav.addObject("areaStors", areaStoreDAO.findAll());
 public List<ErpAreaStore> findAll() {
        String query = "SELECT  ORGANIZATION_CODE "
                + "           , ORGANIZATION_NAME "
                + "  FROM XXAP_AREA_STORE "
                + "  ORDER BY ORGANIZATION_CODE ASC ";
        MapSqlParameterSource param = new MapSqlParameterSource();
        List<ErpAreaStore> inventoryOnhands = getNamedParameterJdbcTemplate().query(query, param, new RowMapper<ErpAreaStore>() {
            @Override
            public ErpAreaStore mapRow(ResultSet rs, int rowNo) throws SQLException {
                ErpAreaStore areaStore = new ErpAreaStore();
                areaStore.setOrganizationCode(rs.getInt("ORGANIZATION_CODE"));
                areaStore.setOrganizationName(rs.getString("ORGANIZATION_NAME"));
                return areaStore;
            }
        });
        return inventoryOnhands;
    }
public class ErpAreaStore implements java.io.Serializable {

    private int organizationCode;
    private String organizationName;

    public int getOrganizationCode() {
        return organizationCode;
    }

    public void setOrganizationCode(int organizationCode) {
        this.organizationCode = organizationCode;
    }

    public String getOrganizationName() {
        return organizationName;
    }

    public void setOrganizationName(String organizationName) {
        this.organizationName = organizationName;
    }

}