Two weeks ago I asked the following, in some hope that I might get a
response. Alas. I will repeat the question, with a follow-up - is it
known whether this problem has been resolved in the latest release?
> I have a fairly serious problem getting the webuijsf:addRemove to
> work. I've examined all the documentation I can find, and the examples
> at <http://webdev2.sun.com/example/faces/index.jsp>, and am still
> entirely befuddled. Briefly, I need to pre-populate both the
> "available" and "selected" lists, as some items are already "selected"
> in the underlying data set.
>
> The code is partially generated, partially hand written, using the
> Visual JSF designer in Netbeans 6.1. The project under consideration
> is deployed to JBoss 4.2.2.GA running under Java 1.5.0_14.
>
> The JSF page has the following for the widget:
>
> <webuijsf:addRemove availableItemsLabel="Available:"
> binding="#{EditGroup.addRemoveList1}"
> id="addRemoveList1"
> items="#{EditGroup.addRemoveList1DefaultOptions.options}"
> label="Users"
> labelOnTop="true"
> required="true"
> rows="20"
> selectAll="true"
> selected="#{EditGroup.addRemoveList1DefaultOptions.selectedValue}"
> selectedItemsLabel="Selected:"
> sorted="true"
> style="left: 168px; top: 144px; position: absolute"/>
>
> the backing bean for the page (which is derived from the bog-standard
> AbstractPageBean) has the following in it's prerender() method:
>
> @Override
> public void prerender() {
> // populate the two text fields from the group info,
> then populate the pick list
> setGroupId(getSessionBean1().getCurrentGroupId());
> Group g = getSessionBean1().getGroup(getGroupId());
> setGroupDescr(g.getName());
> Set<String> members = getSessionBean1().listGroupMembers(groupId);
>
> List<PwsUserDetails> users = getSessionBean1().getUsers();
>
> // make a list of all people NOT in the group already
> List<PwsUserDetails> subList = new LinkedList<PwsUserDetails>();
> for (PwsUserDetails user : users) {
> String uid = user.getLoginName();
> if (!members.contains(uid)) {
> subList.add(user);
> }
> }
>
> Option[] userOptions = new Option[subList.size()];
> int i = 0;
> for (PwsUserDetails user : subList) {
> if (user.getFullName().length() > 0) {
> userOptions[i] = new Option(user.getLoginName(),
> user.getFullName());
> } else {
> userOptions[i] = new Option(user.getLoginName(),
> user.getLoginName());
> }
> i++;
> }
>
> getAddRemoveList1DefaultOptions().setOptions(userOptions);
> getAddRemoveList1DefaultOptions().setSelectedValue(members.toArray());
> getAddRemoveList1().setValue(members.toArray());
> }
>
> (Yes, it's a bit clunky, but I've left it clunky while I'm getting to
> the bottom of the problem.)
>
> The problem is that the values in the "selected" side are never, ever
> getting rendered into the HTML page. The available options render
> fine, though. I have confirmed absolutely that the set of items I am
> trying to put in is not empty. The explicit call to setValue() on the
> bound attribute was out of desperation. The page(s) were tested using
> Safari 3.1.x, MS Internet Explorer 7, and Firefox 3.x, all under
> Windows XP.
>
> Can *anyone* suggest what might be wrong here. Is it something stupid
> that I'm doing, or is it some more sinister underlying (known) bug?
> Responses eagerly sought, if only to prevent me trying to ingest my
> own body weight in coffee.
>
> On that latter note, does anyone else have trouble with the
> dev.java.net websites? I'm finding that they are horribly, horribly
> slow to respond, if at all, and the javascript in them is throwing
> lots of errors.
>