3.8K Star 14.8K Fork 5K

卓源软件 / JeeSite 4.4 and 5.0

 / 详情

<#form:select 加载异常

Backlog
Opened this issue  
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里查看)

Comments (1)

hellojuny created任务

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

Sign in to comment

Status
Assignees
Milestones
Pull Requests
Successfully merging a pull request will close this issue.
Branches
Planed to start   -   Planed to end
-
Top level
Priority
参与者(2)
6732 thinkgem 1651893329
Java
1
https://gitee.com/thinkgem/jeesite4.git
git@gitee.com:thinkgem/jeesite4.git
thinkgem
jeesite4
JeeSite 4.4 and 5.0

Search