I'm having a hell of a time with something that should be extremely simple. I'm using the Struts2 Jquery plugin, and I have an <sj:select>
on my page. It's set to multiple
. I have an array of values that I want to be pre-selected, but nothing is being set. If I give it a single item in the value tag, that single item is selected. If I pass an ArrayList
of Integers
, or a Collection
of Integer
(still an instance of ArrayList
) or a comma-delimited string ("100,101,102") to the value, nothing is selected. I've tried passing a simple array of Integers (Integer[]
) and that will at least select the first item in the array, but that's it. All others are apparently discarded. I cannot understand what I'm doing wrong, or what I can do to make this work.
<sj:select
href="%{myStrutsJSONAction}"
id="itemSelect"
formIds="editForm"
reloadTopics="reloadItem"
name="selectedString"
list="availableItems"
listKey="id"
listValue="description"
multiple="true"
cssClass="form-control"
value="selectedIds"
/>
This was originally a regular Struts2 select (<s:select>
) and that worked perfectly fine with an ArrayList
of Integers
passed to the value tag. I've changed to the Jquery plugin version because I need the data to be reloaded based on the value of a separate list.
The reloadTopics
is working perfectly fine, the data is being repopulated, and when the form submits, all of my selections are correctly passed back to the server. But nothing is initially selected when the page loads.