Hi Priti,
Thanks for the info and confirm that List can be the input type for handler.
I get it working now, i probably had the wrong syntax before, the
syntax below works. Ken also mentioned that there shouldn't be any
space between the curly braces and the double quote. I may have an
extra space in between when i tried this last time.
<!command
getList( outList=>$attribute{myList});
doSomething(theList="${myList}")
/>
thanks
Anissa.
Priti Tiwary wrote:
> Hi Anissa,
>
> Did you try #{} or $attribute{}
> i think this two should help...
>
> I had worked with Lists once while trying for tables and was able to
> debug it well with the use of dumpAttributes handler..
> I am sending you the relevant piece of code
> <!beforeCreate
> createList(size="$int{0}" result=>$page{selectedRows})
> />
>
>
> where
> <sun:button..
> <!command
> setAttribute(key="aSelectedVal" value="anyvalue");
>
> createMap(result=>$attribute{mapName});
> mapPut(map="$attribute{mapName}" key="aVal" value="#{aSelectedVal}");
>
> getList(list="#{selectedRows}" //Note
> passing list here.. newEntry="$attribute{mapName}")
>
> /**
> * <p> This method prints all the List by appending .
> * <p> Input value: "id" -- Type: <code>java.lang.String</code></p>
> * <p> Input value: "required" -- Type:
> <code>java.lang.String</code></p>
> * @param context The HandlerContext.
> */
> @Handler(id="getList",
> input={
> @HandlerInput(name="list", type=List.class, required=true),
> @HandlerInput(name="newEntry", type=Object.class, required=true)
> })
> public static void getList(HandlerContext handlerCtx) {
> List<Object> list = (List<Object>) handlerCtx.getInputValue("list");
> Object newEntry = handlerCtx.getInputValue("newEntry");
> if (list != null)
> list.add(newEntry);
> else {
> list = new ArrayList<Object>();
> list.add(newEntry);
> list.add(newEntry);
> }
> }
>
> HTH...
> println and DumpAttributes helped me debug the whole processing much
> clearly..
>
> priti
>
> Anissa Lam wrote On 10/09/06 09:59 AM,:
>
>
>> Hi Ken,
>>
>> Does handler takes in a List as the input type ? I have the following,
>> and i want to pass the output from getList() to be the input for
>> doSomething().
>> Maybe i don't have the syntax right, but i just can't it to work. I can
>> use Array instead of List if List is not supported.
>>
>> <!command
>> getList( outList=>$attribute{myList});
>> doSomething(theList=${myList}) <==== Whats the correct syntax ?
>> />
>>
>> @Handler(id="getList",
>> output={
>> @HandlerOutput(name="outList", type=java.util.List.class)})
>>
>>
>> @Handler(id="doSomething",
>> input={
>> @HandlerInput(name="theList", type=java.util.List.class,
>> required=true)})
>>
>> thanks
>> Anissa.
>>
>>
>>
>
>