Got it - I needed getSession().info() instead of info(). Thanks guys - I
really appreciate the excellent support.
Matt
mraible wrote:
>
>
>
> Eelco Hillenius wrote:
>>
>>> I'm trying to success messages working. In my Detail.java page, I have:
>>>
>>> protected void onSaveUser(User user) {
>>> userManager.saveUser(user);
>>> getSession().info("It worked!");
>>> setRedirect(true);
>>> setResponsePage(backPage);
>>> }
>>>
>>> First of all, is this the proper way to put messages in flash scope?
>>
>> Yep.
>>
>> You typically don't need to call setRedirect yourself though. Was
>> there any reason for doing that? Also, flash message works good here,
>> but if you already know the page you are going to display it on, you
>> might as well set it on there.
>>
>>
>
> I'm using setRedirect(true) in order to do redirect-after-post so clicking
> refresh on the browser doesn't prompt the user.
>
>
> Eelco Hillenius wrote:
>>
>>
>>> On my "backPage", I have the following code, but it never seems to find
>>> anything.
>>>
>>> // check for success messages
>>> if (!getSession().getFeedbackMessages().isEmpty()) {
>>> // just display first message for now
>>> add(new Label("success-messages",
>>> String.valueOf(getSession().getFeedbackMessages().iterator().next())));
>>> } else {
>>> add(new Label("success-messages", ""));
>>> }
>>
>> That's definitively not the way to do it :)
>>
>> First of all, that code - if it would work - would obviously only take
>> the first message. If you want to display an arbitrary list of things,
>> you should use ListViews or Repeaters.
>>
>> But more importantly, you should just use a FeedbackPanel. Typically,
>> add(new FeedbackPanel("feedback")); does the trick. If you need more
>> fine grained control over which messages to display, you can create it
>> with a IFeedbackMessageFilter. Also, not relevant for this case, but
>> take a look at FormComponentFeedbackBorder as well.
>>
>>
>
> I tried adding that in the page I'm routing to, but not dice - the span
> shows up, but there's nothing it in:
>
> public UserList() {
> setPageTitle(TITLE);
>
> add(new FeedbackPanel("feedback"));
> ...
>
> It really is strange because it seems like it should work.
>
> Thanks,
>
> Matt
>
>
> Eelco Hillenius wrote:
>>
>>
>> Another note is that the way you do labels in your example is rather
>> static. Typically you should try to use models that work in a 'pull'
>> way (gets the results just in time/ when rendering).
>>
>> Take this code (which is comparable to what you did):
>>
>> SomeObject foo = ...
>> if (foo != null) {
>> add(new Label("foo", foo.toString));
>> } else {
>> add(new Label("foo", ""));
>> }
>>
>> rather you should do:
>>
>> SomeObject foo = bar.getFoo();
>> add(new Label("foo", new Model(foo)));
>>
>> or more dynamic (evaluated on every request)
>>
>> add(new Label("foo", new PropertyModel(bar, "foo")));
>>
>> or even
>>
>> add(new Label("foo", new AbstractReadOnlyModel(){
>> public Object getObject() {
>> return bar.getFoo();
>> }
>> });
>>
>> for complete control.
>>
>> Hope that helps,
>>
>> Eelco
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by DB2 Express
>> Download DB2 Express C - the FREE version of DB2 express and take
>> control of your XML. No limits. Just data. Click to get it now.
>> http://sourceforge.net/powerbar/db2/
>> _______________________________________________
>> Wicket-user mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/Is-there-a-success-message-example--tf3642922.html#a10174595
Sent from the Wicket - User mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user