Actually, it's not!

Surprised I didn't think of this before my post, but all you need to do
is overload the methods:

public void onActivate(Integer number1, Integer number2, Integer
number3) {
        System.out.println("Activated with " + number1 + " " + number2 +
" " + number3);
}
        
public void onActivate(Integer number1, Integer number2) {
        System.out.println("Activated with " + number1 + " " + number2);
} 

You can't make the values limitless, but as you can see from above, you
can definitely make them optional!

-----Original Message-----
From: Nick Westgate [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 30, 2007 10:23 PM
To: Tapestry users
Subject: Re: T5: Activation contexts

That is in fact the only option for now.

Cheers,
Nick.


Josh Canfield wrote:
> In situations where I have had optional parameters I've ended up using

> an Object[] as the argument and figuring out what the values mean
myself.
> 
> public Object onActivate(Object[] context) { }
> 
> I haven't looked closely enough at the code to determine if there is a

> better option.
> 
> Josh
> 
> On 8/30/07, Joel Wiegman <[EMAIL PROTECTED]> wrote:
>> Hello all,
>>
>> I'm wondering if anyone has had any luck making the "activation 
>> contexts" of pages a little more flexible.
>>
>> For example, let's say I have a "Sum.java" page that wants to take in

>> between 1 and 4 Integers and add them together:
>>
>> //is there a way to make number3 and number4 "optional"?  Seems like 
>> Tapestry forces me to provide values for all 4 numbers.
>> public void onActivate(Integer number1, Integer number2, Integer 
>> number3, Integer number4)
>>
>> //Or even make the values limitless?
>> public void onActivate(Integer... numbers)
>>
>> Kind of a contrived example, but hopefully you see where I'm going 
>> with it.
>>
>> Anyone had any luck with making context parameters optional or 
>> limitless?
>>
>> Thanks,
>>
>> Joel
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to