Reputation: 55
I'm *currently learning how to use tapestry 5.3.6 and i have one issue. I need to share information between 2 pages to do a full registration for a user to a fake mobile operator and i don't know what is the right way to do this, firstly i thought that the @Persist could do this trick but i realized that this annotation keep information for a specific page eand don't share it with other pages... I think the @SessionStated is the answer but i'm not sure :/
Here is a schema to illustrate my needing :
First page : "personnal information" => Second page "credit card information" => Third page : "Resume and policies acceptation before final submission"
I hope that you can help me... Thanks a lot !
Upvotes: 0
Views: 686
Reputation: 55
We can do this with various method which are explained on this link : http://jumpstart.doublenegative.com.au/jumpstart/examples/state/passingbypersist
We can use the session, or use the @Persist, for the persist method we need to implement a public method to pass parameters to the next page which is going to be called.
The second solution was the solution I was looking for.
Upvotes: 1
Reputation: 3791
You can do this with @SessionAttribute, @SessionState and through Session.
Session attributes:
@SessionAtribute("myObject")
private MyObject myObject;
Session-wide objects:
@SessionState
private MyObject myObject;
Session API:
@Inject
private Request request;
void someMethod() {
final Session session = request.getSession(true);
session.setAttribute("myObject", myObject);
}
More information here
Upvotes: 2