You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Angelo Chen <an...@yahoo.com.hk> on 2009/05/03 13:48:04 UTC

t5: InjectPage and context

Hi,

I have a page called WriteMsg, in another page I use follow code to inject
the page

@InjectPage
private WriteMsg writeMsg

Ojbect onActionFromWrite() {	
	return writeMsg;
}

but how to pass a context to the instance of page without using @Persist
instances?

Thanks,



public class WriteMsg {

	Object onActivate(EventContext ec) {
	}

}	
-- 
View this message in context: http://www.nabble.com/t5%3A-InjectPage-and-context-tp23355029p23355029.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: InjectPage and context

Posted by Ville Virtanen <vi...@cerion.fi>.
Forgot to mention that the PageRenderLinkSource is not part of T5.0.18, It
was introduced later.

 - Ville


Ville Virtanen wrote:
> 
> Hi,
> 
> Two solutions:
> 
> 1. Use PageLink in tml. (And supply the context to it from the java class)
> 
> 2. Use PageRenderLinkSource (return
> PageRenderLinkSource.createPageRenderLinkWithContext(WriteMsg.class,
> Object... context);)
> 
> Neither requires injected page.
> 
>  - Ville
> 
> 
> Angelo Chen wrote:
>> 
>> Hi,
>> 
>> I have a page called WriteMsg, in another page I use follow code to
>> inject the page
>> 
>> @InjectPage
>> private WriteMsg writeMsg
>> 
>> Ojbect onActionFromWrite() {	
>> 	return writeMsg;
>> }
>> 
>> but how to pass a context to the instance of page without using @Persist
>> instances?
>> 
>> Thanks,
>> 
>> 
>> 
>> public class WriteMsg {
>> 
>> 	Object onActivate(EventContext ec) {
>> 	}
>> 
>> }	
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/t5%3A-InjectPage-and-context-tp23355029p23356065.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: InjectPage and context

Posted by Ville Virtanen <vi...@cerion.fi>.
Hi,

Two solutions:

1. Use PageLink in tml. (And supply the context to it from the java class)

2. Use PageRenderLinkSource (return
PageRenderLinkSource.createPageRenderLinkWithContext(WriteMsg.class,
Object... context);)

Neither requires injected page.

 - Ville


Angelo Chen wrote:
> 
> Hi,
> 
> I have a page called WriteMsg, in another page I use follow code to inject
> the page
> 
> @InjectPage
> private WriteMsg writeMsg
> 
> Ojbect onActionFromWrite() {	
> 	return writeMsg;
> }
> 
> but how to pass a context to the instance of page without using @Persist
> instances?
> 
> Thanks,
> 
> 
> 
> public class WriteMsg {
> 
> 	Object onActivate(EventContext ec) {
> 	}
> 
> }	
> 

-- 
View this message in context: http://www.nabble.com/t5%3A-InjectPage-and-context-tp23355029p23355810.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