Wesley,

I think you have 3 ways of doing that :
1) if the data you pass from one page to another is simple (a short string, of an integer for instance), you can get a ref on that page, put this value in it, and use the onPassivate / onActivate mecanism to store it, something like that :

Page 1 :
@InjectPage
private Page2 page2 ;

somewhere in your code :
page2.setValue(32) ;

Page 2 :
private int value ; // with setter and getter

int onPassivate() { return value ; }
void onActivate(int value) { this.value = value } ;

Now if value is a more complex object, you have to make it a string, and to rebuild it from that string... not always very handy, but the T5 JSON support might help you.

2) Use @Persist
Code for page 1 is the same
Page 2  :
@Persist
private MyClass value ; // with getter and setter

// dont use onActivate / onPassivate

3) Use @ApplicationState
Page 1 :
@ApplicationState
private MyClass value ;

somewhere in your code :
this.value = value ;

Page 2
@ApplicationState
private MyClass value ;

and value will have the value you set in page 1. Note that this is bound to the class name, and it doesnt support templates (because of the way templates are supported in Java 5).




hi all,

is there any way to pass a list of string or user defined objects between
pages in tapestry 5? currently like CRUD operation, the only way to pass
parameter around is only string through onActivate() and onPassivate().
please advise, thanks

regards,
wesley


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

Reply via email to