Reputation: 12242
Select tag in jsp is containing list of Plan objects
Here is a Plan class
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" />
Now i want listkey to have multiple values separated by comma like(packageId,price)
How can i achieve this ?
Upvotes: 2
Views: 7280
Reputation: 50193
Simply specify it in the key attribute:
<s:select theme = "simple"
list = "%{#request.packageList}"
listKey = "packageId + ',' + price"
listValue = "packageName"
headerKey = "0"
headerValue = "--Select--"
name = "myNewCustomKey"
cssClass = "dropdowm"
id = "packageID" />
And (if you are not using a recent version) use cssClass
instead of class
in Struts Tags.
Upvotes: 2