3.9K Star 18.4K Fork 5.3K

卓源软件 / JeeSite 4.x and 5.x

 / 详情

<#form:select 加载异常

已完成
创建于  
2022-06-10 22:16

是什么问题、该问题是怎么引起的?

  1. 如何设置form:select数据源

重现步骤、期望结果、截图、代码

<#form:select path="storeName" items="storeList" itemLabel="storeName" itemValue="storeCode" class="form-control" />

List<SelectEntity> storeList = new ArrayList<SelectEntity>();
for (String store : storeArray) {
	SelectEntity entity = new SelectEntity();
	entity.setStoreCode(store);
	entity.setStoreName(store);
	storeList.add(entity);
}
model.addAttribute("storeList", storeList);

实际结果、报错信息、截图

>>11:00:58:期望遍历目标是是集合,数组,Iterator,Iterable(COLLECTION_EXPECTED_ERROR):p.items 位于87行 资源:/htmltags/form/select.html
实际类型是:class java.lang.String
84| 	if (p.blankOption && p.multiple != 'true'){
85| 		%><option value="${p.blankOptionValue}">${p.blankOptionLabel}</option><%
86| 	}
87| 	for (var item in p.items){
88| 		var iv = @ObjectUtils.toString(@ReflectUtils.invokeGetter(item, p.itemValue));
89| 		var il = @ObjectUtils.toString(@ReflectUtils.invokeGetter(item, p.itemLabel));
90| 		var attr = '';
  ========================
  调用栈:
  /htmltags/form/select.html 行:87

环境版本:

  • JDK版本:1.8、11、17
  • 浏览器版本:Chrome xx、Firefox xx、IE xx
  • 平台版本:JeeSite 4.x.x、5.x.x(pom.xml里查看)

评论 (1)

hellojuny 创建了任务

items="storeList" 改为 items="${storeList}"

卓源软件 任务状态待办的 修改为已完成

登录 后才可以发表评论

状态
负责人
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
参与者(2)
6732 thinkgem 1651893329
Java
1
https://gitee.com/thinkgem/jeesite4.git
git@gitee.com:thinkgem/jeesite4.git
thinkgem
jeesite4
JeeSite 4.x and 5.x

搜索帮助