You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by ael <al...@dash.com.ph> on 2010/09/16 01:33:23 UTC

T5 Active Context Query.

Hello Everyone

I have an active context which is a string value.

--- page1

Object onActivate(String value1){

	if(!value1.trim().equals("")){

		return null;
	}
	else
		return page2;
}

My Query is how can i check if the active context value1 is null?
Ex. http://localhost/page1/

I want to redirect to another page if the active context value1 is null.

i already try to set

if(value1 == null)
   return errorpage

But no luck...

Any ideas :)
-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Active-Context-Query-tp2841529p2841529.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5 Active Context Query.

Posted by ael <al...@dash.com.ph>.
Hello Thiago

Wow... PERFECT ^_^... 

Thanks...
-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Active-Context-Query-tp2841529p2841724.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5 Active Context Query.

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, 15 Sep 2010 20:33:23 -0300, ael <al...@dash.com.ph> wrote:

> Hello Everyone

Hi!

> I have an active context which is a string value.
>
> --- page1
>
> Object onActivate(String value1){
>
> 	if(!value1.trim().equals("")){
>
> 		return null;
> 	}
> 	else
> 		return page2;
> }

If you have an onActivate() method with a single parameter that isn't  
EventContext, List or Object[], the method will only be called if there's  
at least one context parameter.

The recommended way of dealing with a variable number of context  
parameters is receiving a single EventContext parameter:

Object onActivate(EventContext context) {
	if (context.getCount() == 0) {
		return page2;
	}
	String value = context.get(String.class, 0);
	...
	return null;
}

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org