On Tue, Mar 20, 2012 at 9:44 AM, Beat Durrer <bdur...@gmail.com> wrote: > Since T5 still can't predict the future (pfff!), you need to set the > reference to the user yourself :) > There are several ways to do this... > So, all your CreateGame page needs is the user - right? > Then let's add an page activation context:
Current user as the activation context for createGame? Doesn't look too secure - obviously you can still do that if you put proper checks in place but it's unnecessary especially if the owner of the newly created game is always the currently logged in user. I'd typically do this by creating a lightweight CurrentUser Session State Object that stores an id of the user entity (perhaps name, username as well since you often need those). You could have a UserService.getUser() that fetches the user entity using the id provided by CurrentUser. In your createGame, you'd just do new Game().setOwner( userService.getUser()). I might not even have separate CreateGame page but pages.game.GameEdit and use a special context "new" for creating a name Game, otherwise use the page context for specifying the game you are currently modifying. This way you'd get nice urls /game/edit/new and game/edit/1 (or even better, use some natural id as context, so you'd get /game/edit/lazertag). Kalle --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org