users@woodstock.java.net

Re: webuijsf:listbox multiple option not working

From: Ken Paulsen <Ken.Paulsen_at_Sun.COM>
Date: Tue, 02 Jun 2009 11:34:41 -0700

Hi Gigi,

I was using FF 3.0.10, although I would be surprised if the browser mattered.  sun:listbox *is* the same as webuijsf:listbox (JSFT just has a different default prefix).

Ken

gigi shea wrote:
Hello, Ken,

Thank you so much for your reply. Do you mind me asking in which browser
did you try your result page? IE (8.0.6001) is the only one giving me
the scroll bar, with my posted code (or change the backing bean's
corresponding property to a list of options). Neither Firefox (3.0.10)
nor chrome(1.0.154.65) is giving me the result right.

Is there any other way to get the webuijsf:listbox multiple working
rather than turning to sun:listbox? I'm trying to figure out all the
possible choices I can sort to

Very grateful for your kind help. Truly appreciate it


  
Hi gigi2,

I tried in my environment (Woodstock 4.3.0.9 with JSFTemplating) and did not see any problems at all.  Here is what I tried:

<sun:listbox rows="5" labels={"a", "b", "c", "d", "e", "f", "g", "h"} multiple="true" />

JSFT has builtin support for Woodstock, so "sun:listbox" is the same component you are using.  JSFT also has builtin List support... that's what the {}'s are doing.  And JSFT provides a short-cut for creating Options via the "labels" attribute (and optionally the "values" attribute).

I noticed you were returning an array of Option, perhaps you should try a List of Option.

Good luck!

Ken

-----Original Message-----
From: gigi2 <ggtech888@gmail.com>
Sent: Monday, June 01, 2009 12:28 PM
To: users@woodstock.dev.java.net
Subject: webuijsf:listbox multiple option not working


Hello, JSF gurus,

I tried to use webuijsf:listbox for a multiple select dropdown list. Bu the
result list does NOT have a scroll bar even if I have more items than
specified in 'rows'. I've been searching on web for a while for this but it
seems everyone is using it with 'multiple='false''. It does not matter I
used 'selected' (with backing as an array of String or Object). The scroll
never shows up




JSP code
<webuijsf:listbox disabled="false" multiple="true" rows="1" id="test2"
items="#{queryBean.allPlatforms}" />

Java Bean code
public Option[] getAllPlatforms() {
List<Option> tmpPlatforms = new ArrayList<Option>();

tmpPlatforms.add( new Option("t1", "t1") );
tmpPlatforms.add( new Option("t2", "t2") );
tmpPlatforms.add( new Option("t3", "t3") );

allPlatforms = tmpPlatforms.toArray(new Option[1]);

return allPlatforms;
}

public void setAllPlatforms(Option[] allPlatforms) {
this.allPlatforms = allPlatforms;
} 

if I remove 'multiple="true"', then the scroll bar shows up. And when I put
'multiple="true"' back in, the scroll bar is just gone. Seems to me no one
has tried this option with listbox before. 

Please help. Feeling so desperate. What a headache! Thank you very much in
advance