Did you examine your log output?

For:
http://localhost:8080/myapp/Start/1/2/3
You'll see:
Activated with 1 2
_and_
Activated with 1 2 3

If you add a no argument onActivate() that will also be called.
Object[] is the best solution right now for multiple parameters.
http://issues.apache.org/jira/browse/TAPESTRY-1695

Cheers,
Nick.



Joel Wiegman wrote:
> 
> 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]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/T5%3A-Activation-contexts-tf4356640.html#a12431309
Sent from the Tapestry - User mailing list archive at Nabble.com.


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

Reply via email to