On Tue, Apr 30, 2013 at 5:58 PM, Bas Gooren <b...@iswd.nl> wrote:

> Hi,
>
> Since you are redirecting to another stateless page
> (setResponsePage(Class)), the browser is redirected to the new url which
> creates a new, temporary session for the second request.
>
> If you don't link to another page (so no setResponsePage call), it will
> work, since the response is rendered in the same request cycle as the
> request.
>

Correct!
Wicket needs to make the redirect to change the url in the browser address
bar. And renders the page in the second request ...
So you may be right - org.apache.wicket.Session#addFeedbackMessage() should
bind the session. Or at least write a warning for temporary sessions.


>
> Met vriendelijke groet,
> Kind regards,
>
> Bas Gooren
>
> Op 30-4-2013 17:44, schreef Bertrand Guay-Paquet:
>
>  Hi,
>>
>> This is not the behavior I'm getting. I created a stateless page with
>> this:
>>
>>         add(new FencedFeedbackPanel("feedback"**));
>>         add(new StatelessLink<Void>("success") {
>>             @Override
>>             public void onClick() {
>>                 getSession().info("Success message (without bind())");
>>                 setResponsePage(**SessionMessagePage.class);
>>             }
>>         });
>>         add(new StatelessLink<Void>("**successBind") {
>>             @Override
>>             public void onClick() {
>>                 getSession().bind();
>>                 getSession().info("Success message (with bind())");
>>                 setResponsePage(**SessionMessagePage.class);
>>             }
>>         });
>>
>> The "success" link does not display a session message in the feedback
>> panel if the session is temporary. It does work when the session is bound
>> however.
>>
>> I stepped inside FenceFeedbackPanel#**newFeedbackMessagesModel() and
>> compared the Session object returned by getSession() there and in the
>> "success" link. They are not the same java object.
>>
>> On 30/04/2013 7:07 AM, Martin Grigorov wrote:
>>
>>> Hi,
>>>
>>> Wicket uses temporary Sessions for stateless application.
>>> Adding a feedback message to such session will live till the end of the
>>> current request. Since the response page is rendered in the same
>>> request/response cycle the feedback messages should be still reachable.
>>>
>>>
>>>
>>> On Mon, Apr 29, 2013 at 11:41 PM, Bertrand Guay-Paquet <
>>> ber...@step.polymtl.ca> wrote:
>>>
>>>  Hello,
>>>>
>>>> When using the Sessions info(), error() and success() methods, and the
>>>> session is not bound, the messages are lost. This can happen easily
>>>> when on
>>>> stateless pages. The fix for this is easy: I need to make sure the
>>>> session
>>>> is bound and call Session.bind().
>>>>
>>>> However, I think it would be nice for the Session to get bound
>>>> automatically when adding messages to it. Otherwise, the messages are
>>>> silently discarded and the cause is not so obvious. What do you think,
>>>> should I open an issue for this?
>>>>
>>>> Regards,
>>>> Bertrand
>>>>
>>>> ------------------------------****----------------------------**--**---------
>>>>
>>>> To unsubscribe, e-mail: 
>>>> users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>> <users-unsubscribe@**wicket.apache.org<users-unsubscr...@wicket.apache.org>
>>>> >
>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>
>>>>
>>>>
>>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: 
>> users-unsubscribe@wicket.**apache.org<users-unsubscr...@wicket.apache.org>
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>


-- 
Martin Grigorov
Wicket Training & Consulting
http://jWeekend.com <http://jweekend.com/>

Reply via email to