You can replace <chooser:available> with a <html:options> or <html:optionsCollection> tag. They pretty much require the same parameters as you require, the same goes for using <html:image> instead of the chooser button tags.

You will find that this is a LOT easier and more customizeable than rolling your own. Why go create a custom tag when you don't have to? I am just someone who is against customization instead of standardization. What if you need to change how your form is layed out? This can be done within the JSP instead of rewriting the tag library which makes maintenance about a million times easier.

Also, if you use Tiles, you can package these together into a tile and reused over and over. This is your best choice, I think.

-----Original Message-----
From: lgc@possibility.com [mailto:lgc@possibility.com]
Sent: Monday, December 08, 2003 12:24 PM
To: John.Pitchko@shell.ca
Cc: struts-user@jakarta.apache.org
Subject: RE: [OT] Looking for a Taglib

You're right, the existing taglib doesn't address the javascript issue. 

Maybe configuration was the wrong word. I'm really talking about defining all the components that are part of  composite chooser. 
Even with taglibs in the jsp, you need a label for each list box, each list box, a collection for each list box and 2 (or 4 if you want an Add All /Remove All) buttons. While adding all these elements and defining the parameters isn't horrible, it does take work that is repeated for each chooser widget. While the instance would be different across pages, each "chooser" needs to have these elements. 

Imagine...
<chooser:available label="Available States" collection="states"/> (automatically creates a list box)
<chooser:addAllButton/>  (onClick automatically set, label optional...)
<chooser:addButton/> 
<chooser:removeButton/>
<chooser:removeAllButton/>
<chooser:selected label="Selected State(s)" collection="selectedStates"/>
<chooser:javascript/>  (similar to the <html:javascript/> tag for the validator...)

or better yet...
<chooser:import jsFile="chooser.js"/>
<chooser:set availableLabel="Available States" availableCollection="states"
                     selectedLabel="Selected State(s)" selectedCollection="selectedStates"
                      addAll="true" removeAll="true" />

L:)

John.Pitchko@shell.ca wrote:

You can pass the "available" and "selected" collections to an
html:optionsCollection tag and it will render the boxes fine, however
this does not solve your JavaScript problem. There is not really a lot
of configuration to do, just place a data bean in a scope and point the
html:optionsCollection tag to the bean.

-----Original Message-----
From: lgc@possibility.com [mailto:lgc@possibility.com]
Sent: Monday, December 08, 2003 11:50 AM
To: John.Pitchko@shell.ca
Cc: struts-user@jakarta.apache.org
Subject: RE: [OT] Looking for a Taglib

It's pretty early in the game for me so I'm open to any suggestion. :)

On some pages I have more than one of these "list box choosers" (for 
lack of a better name).
I suppose as long as I pass the two list boxes & buttons, that would
work.

I was thinking is would be nice if I could just treat the whole thing as

one big component.
Say pass the "available" and "selected" collections to a taglib & let it

do most of the work.
Even using the html taglib, there's quite a bit of configuration do to 
set the labels, listboxes,
collections, button, etc. Oh well, I guess I'll leave it and if it 
become a big problem later
I can roll my own. :)

Thanks for the idea!!
L:)

John.Pitchko@shell.ca wrote:

As far as I know, there are not any JavaScript-backed tag libraries (I
am pretty sure that any standard tag library won't provide the dynamic
features that you are looking for without having to do a page refresh).

Have you considered dumping all your JavaScript to a .js file,
    
importing
  
it into your webpage, and associating it with the buttons?

-----Original Message-----
From: struts-user-digest-help@jakarta.apache.org
[mailto:struts-user-digest-help@jakarta.apache.org]
Sent: Monday, December 08, 2003 10:07 AM
To: struts-user@jakarta.apache.org
Cc: lgc@possibility.com
Subject: [OT] Looking for a Taglib

Hi List,

I have several pages that need to show users a list of available
    
options
  
in one listbox, an add & remove button & a list box that shows the 
options they've already selected. This fairly common in UI's & I've
    
seen
  
this on a few web pages something like this...

Available States                   Selected States
+------------+                    +--------------+
| Alabama    |                    | Connecticut  |
| Alaska     |   +---------+      | Maine        |
| Arizona    |   |   Add>> |      |              |
| Arkansas   |   +---------+      |              |
| California |                    |              |
| Colorado   |   +---------+      |              |
| Delaware   |   |<<Remove |      |              |
| Florida    |   +---------+      |              |
+------------+                    +--------------+

I've looked on Google, SourceForge & Jakarta for a taglib that
would do something like this, without success.

Obviously the html taglib will help with the buttons & listboxes,
but there's a lot of javascript needed to support this kind of
widget & it would be a lot easier to manage if there was a taglib
that could generate it.

Does anyone know of a taglib that could help with this and/or
another source finding taglibs?

Thanks in advance.
Linda :)