gpt4 book ai didi

java - struts2中select标签的list key属性如何指定多个值

转载 作者:行者123 更新时间:2023-11-30 09:13:26 25 4
gpt4 key购买 nike

jsp 中的选择标签包含计划对象列表

这是一个计划类

public class Plan {

private String packageId;
private String packageName;
private String price;

public String getPackageId() {
return packageId;
}
public void setPackageId(String packageId) {
this.packageId = packageId;
}
public String getPackageName() {
return packageName;
}
public void setPackageName(String packageName) {
this.packageName = packageName;
}

public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
}

<s:select theme="simple" list="%{#request.packageList}" listKey="packageId"
listValue="packageName" headerKey="0" headerValue="--Select--"
name="packageID" class="dropdowm" id="packageID" />

现在我希望 listkey 有多个用逗号分隔的值,比如 (packageId,price)

我怎样才能做到这一点?

最佳答案

只需在key属性中指定即可:

<s:select theme = "simple" 
list = "%{#request.packageList}"
listKey = "packageId + ',' + price"
listValue = "packageName"
headerKey = "0"
headerValue = "--Select--"
name = "myNewCustomKey"
cssClass = "dropdowm"
id = "packageID" />

并且(如果您使用最新版本)在 Struts 标签中使用 cssClass 而不是 class

关于java - struts2中select标签的list key属性如何指定多个值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21039289/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com