dev@woodstock.java.net

Re: JSFTemplating: sun:addRemove tag help

From: Ken Paulsen <Ken.Paulsen_at_Sun.COM>
Date: Thu, 10 May 2007 00:05:07 -0700

Hi Karam,

It appears to be a bug in Woodstock.  When the value you have bound to "selected" is null, it doesn't appear to be working (I didn't dive into the code to confirm this).

I found an easy work-a-round for you:

    <sun:addRemove id="toolName" items="$attribute{toolList}" selected="#{pageSession.toolName}" availableItemsLabel="Available:" selectedItemsLabel="Selected:" sorted="true" labelOnTop="true" rows="6">
        <!beforeCreate
            getSunOptions(labels={"a", "b", "c"}, values={"1", "2", "3"}, options=>$attribute{toolList});
            setPageSessionAttribute(key="toolName" value=[]);
        />
    </sun:addRemove>


Setting the pageSession to [] in the beforeCreate event solves the problem (this is an empty array).  Let me know if you still see a problem.  Feel free to file this issue against woodstock (https://woodstock.dev.java.net) if you'd like.

Ken Paulsen
https://jsftemplating.dev.java.net


Karam Singh Badesha wrote:
Anyone?

thanks
Karam

Karam Singh Badesha wrote On 05/09/07 02:23 PM,:

Hi,
I have the following:

<sun:addRemove
                id="toolName"
                items="$attribute{toolList}"
                selected="#{pageSession.toolName}"
                availableItemsLabel="Available:"
                selectedItemsLabel="Selected:"
                sorted="#{true}"
                labelOnTop="#{true}"
                rows="$int{6}"
                />

In my handler code, toolName is of type String[].  When I submit on this page, eventhough I haven't set this component as "required", it keeps coming back in "red" suggesting it is required.  So I am guessing maybe I am defining it wrong in the above code. Can someone let me know what do I need to change to get this to work.

What would be the correct code for:
selected="#{pageSession.toolName}"

thanks
Karam