Hi, I'm trying to implement a standard mechanism for providing feedback to users after they perform operations such as your standard CRUD operations. The idea is that they click a link such as "delete" and it performs the operation returns to that page, but with a message along the top that says "<something> has been deleted". The vast majority of the users state is stored in the page's activation context, but I don't want to store the feedback message there as it ends up complicating the context processing across all of the applications pages.
Storing the message using @Persist(PersistenceConstants.FLASH) seems like the way to go. However, because many of my operations are used across multiple pages I decided to implement these operations as separate pages that perform the operation and return to the caller. Here is an example: public class DeleteItem { @Inject private ItemDao itemDao; @Inject private PageRenderLinkSource pageLinkSource; @Inject private ComponentSource componentSource; @CommitAfter public Object onActivate( long id, String page ) { return deleteItem( id, page, null ); } @CommitAfter public Object onActivate( long id, String page, String context ) { return deleteItem( id, page, context ); } private Object deleteItem( long id, String page, String context ) { itemDao.delete( id ); // Component comp = componentSource.getPage( page ); // if( comp instanceof FlashMessagePage ) { // ((FlashMessagePage)comp).setFlashMessage( "Bah Humbug!" ); // } // return ???; return context != null ? pageLinkSource.createPageRenderLinkWithContext( page, context ) : pageLinkSource.createPageRenderLink( page ) ; } } The crux of my problem is in the commented code. I need to return a specific page (comp) which has had flash persisted page properties set on it, but I also need to set the context for that page. However, all mechanisms for creating a link with a passivation/activation context (that I can see) only accept a page name (String) or the class object of the page (Class). How do I return a specific page instance with an activation context? In the above code, it would be nice if I could do the following: private Object deleteItem( long id, String page, String context ) { itemDao.delete( id ); Component comp = componentSource.getPage( page ); if( comp instanceof FlashMessagePage ) { ((FlashMessagePage)comp).setFlashMessage( "Bah Humbug!" ); } return context != null ? pageLinkSource.createPageRenderLinkWithContext( comp, context ) : pageLinkSource.createPageRenderLink( comp ) ; } Thanks, Pete Poulos --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org