我正在尝试在struts迭代器中设置一个下拉列表,并且它在评估索引变量时遇到问题,导致下拉列表未被选中。
<s:select list = "itemTypeList"
listKey = "itemId"
listValue = "description"
headerKey = "-1"
headerValue = ""
value = "%{IteratorList[%{#status.index}].itemBase.{itemId}}"
/>
我发现在值中对索引进行硬编码使其正确评估
value ="%{IteratorList[0].itemBase.{itemId}}" />
如何评估索引?任何帮助表示赞赏!
有关设置的背景信息 - 用户首先能够过滤jsp中的项目列表,然后添加一个使用先前过滤选项的新列表项目,以设置与列表项目关联的单个下拉列表。
答案 0 :(得分:1)
您无法嵌套<s:select list = "itemTypeList"
listKey = "itemId"
listValue = "description"
headerKey = "-1"
headerValue = ""
value = "%{IteratorList[#status.index].itemBase.{itemId}}"
/>
,也不需要。以下应该足够了:
var when = require('when'); // I'm using when@3.7.4 node_modules/when
console.log("INIT");
when.promise(function(resolve, reject) {
return when.reject("false")
.then(function(ok) {
console.log("Step 1 - in then, ok = %s", ok);
return 'ok1';
}, function(err) {
console.log("Step 1.1 - in catch, err = %s", err);
return reject(err);
}).then(function(ok) {
console.log("Step 2 - in then, ok2 = %s", ok);
return resolve("done");
}).catch(function(err) {
console.log("Step 3 - in catch, err = %s", err);
return reject(err);
});
}).then(function(mainok) {
console.log("Step 9 - in main then, mainok = %s", mainok);
}).catch(function(err) {
console.log("Step 9 - in main catch, err = %s", err);
});