Hello Bertrand, Where is your Page2 code fragment called? Is in the page constructor, in a page component onSubmit() method, or somewhere else?
My guess is that your code fragment is called in the page constructor. If this is so, then: · I might expect the differences in behaviour you experience between setResponsePage(WebPage.class) and using a RestartResponseException (as always, I am open to contradiction). · If possible, can you move your code to a component onSubmit() method (of Page2 or the previous page, if any)? Regards, Ian Bertrand Guay-Paquet wrote > > Hi, > > I have 2 pages, each with a feedback panel. Page2 does the following: > setACookie(); > Session.get().info("blah"); > setResponsePage(Page1.class); > > The problem I have is that "blah" is never displayed in the feedback > panel of Page1. I stepped in the request processing code and found that > setResponsePage() actually renders the full current page before throwing > that away and issuing a 302 redirect. During this first (unused) > rendering of Page2, its feedback panel consumes all the session > messages. After the client follows the 302 and requests Page1, there are > no more session messages to display. > > Instead of setResponsePage, I can use a RestartResponseException to > redirect to Page1 and the session messages will then be displayed on > Page1 because Page2 is never rendered. However this has the important > downside of also throwing away all header information (e.g. cookies like > setACookie() above). > > Is there a way to both set a cookie and display the session message on > the response page? > > Bonus! > I'm also wondering why, when setResponsePage() is used, the current page > is still rendered. I can think of 3 reasons why this should be avoided: > 1-Performance; it's wasteful to render components to discard them right > away > > 2-Components hierarchy; even if setResponsePage() is used in a page > constructor (e.g. when redirecting depending on page parameters), since > the page is rendered, all of its components or some substitutes must be > added to the page. Otherwise Wicket will throw a missing component > exception in dev mode. > > 3-My use case; feedback messages registered in the session can be > swallowed by a feedback panel in the thrown away page rendering. > > Of course, I definitely don't have the complete picture and am just now > making some sense of how Wicket handles redirects and responses. > > Regards, > Bertrand > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@.apache > For additional commands, e-mail: users-help@.apache > -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/setResponsePage-swallows-my-session-feedback-messages-tp4650274p4650278.html Sent from the Users forum mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org