Re: [Wicket-user] Is there a success message example?

2007-04-25 Thread mraible



igor.vaynberg wrote:
 
 On 4/24/07, mraible [EMAIL PROTECTED] wrote:

 
  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.
 
 what eelco meant to say is that wicket does redirect-after-post for you by
 default, thus no need for you to bother with it.
 

Does it do this with 1.2.6? 

When I don't have it, and I hit refresh after submitting a form, I get the
good ol' postdata message from Firefox. If I add setRedirect(true), there
is no message.

Matt
-- 
View this message in context: 
http://www.nabble.com/Is-there-a-success-message-example--tf3642922.html#a10175013
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
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Is there a success message example?

2007-04-25 Thread Igor Vaynberg

its been doing that since before 1.0 afaik. in fact i dont even remember
what that dialog looks like anymore :)

did you mess with render strategies at all? i think if you change the strat
to one-pass-render it might not do it for you.

-igor

On 4/24/07, mraible [EMAIL PROTECTED] wrote:





igor.vaynberg wrote:

 On 4/24/07, mraible [EMAIL PROTECTED] wrote:

 
  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.

 what eelco meant to say is that wicket does redirect-after-post for you
by
 default, thus no need for you to bother with it.


Does it do this with 1.2.6?

When I don't have it, and I hit refresh after submitting a form, I get the
good ol' postdata message from Firefox. If I add setRedirect(true),
there
is no message.

Matt
--
View this message in context:
http://www.nabble.com/Is-there-a-success-message-example--tf3642922.html#a10175013
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
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-
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
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Is there a success message example?

2007-04-25 Thread Eelco Hillenius
 Does it do this with 1.2.6?

 When I don't have it, and I hit refresh after submitting a form, I get the
 good ol' postdata message from Firefox. If I add setRedirect(true), there
 is no message.

That's surprising. What does your application object look like?

The default IRequestCycleSettings.RenderStrategy setting for Wicket
(since quite a long time) is to use
IRequestCycleSettings#REDIRECT_TO_BUFFER. Did you change that to
ONE_PASS_RENDER by any chance?

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
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Is there a success message example?

2007-04-25 Thread Martijn Dashorst
On 4/25/07, mraible [EMAIL PROTECTED] wrote:
 Does it do this with 1.2.6?

 When I don't have it, and I hit refresh after submitting a form, I get the
 good ol' postdata message from Firefox. If I add setRedirect(true), there
 is no message.

If you haven't changed the default render strategy it should work. I
just fired up my released wicket-examples (1.2.6) and the form input
example works without post back upon back button presses.

Martijn

-- 
Learn Wicket at ApacheCon Europe: http://apachecon.com
Join the wicket community at irc.freenode.net: ##wicket
Wicket 1.2.6 contains a very important fix. Download Wicket now!
http://wicketframework.org

-
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
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Is there a success message example?

2007-04-25 Thread Igor Vaynberg

rofl, ok thats only three of the same response so far, lets see if we can
rack up some more. i wish gmail could tell you that someone is responding to
the same message you are. it does IM, why not this???

-igor


On 4/24/07, Martijn Dashorst [EMAIL PROTECTED] wrote:


On 4/25/07, mraible [EMAIL PROTECTED] wrote:
 Does it do this with 1.2.6?

 When I don't have it, and I hit refresh after submitting a form, I get
the
 good ol' postdata message from Firefox. If I add setRedirect(true),
there
 is no message.

If you haven't changed the default render strategy it should work. I
just fired up my released wicket-examples (1.2.6) and the form input
example works without post back upon back button presses.

Martijn

--
Learn Wicket at ApacheCon Europe: http://apachecon.com
Join the wicket community at irc.freenode.net: ##wicket
Wicket 1.2.6 contains a very important fix. Download Wicket now!
http://wicketframework.org

-
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
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-
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
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Is there a success message example?

2007-04-25 Thread mraible



Eelco Hillenius wrote:
 
 Does it do this with 1.2.6?

 When I don't have it, and I hit refresh after submitting a form, I get
 the
 good ol' postdata message from Firefox. If I add setRedirect(true),
 there
 is no message.
 
 That's surprising. What does your application object look like?
 
 The default IRequestCycleSettings.RenderStrategy setting for Wicket
 (since quite a long time) is to use
 IRequestCycleSettings#REDIRECT_TO_BUFFER. Did you change that to
 ONE_PASS_RENDER by any chance?
 

Yes, I did. 

// Fixed SiteMesh:
http://spatula.net/blog/2006/10/wicket-sitemesh-feces-nocturnus.html
   
getRequestCycleSettings().setRenderStrategy(IRequestCycleSettings.ONE_PASS_RENDER);

It's likely be pretty easy to port when I have with SiteMesh to use the page
extension stuff that Wicket has, but I'm lazy. ;-)

Matt
-- 
View this message in context: 
http://www.nabble.com/Is-there-a-success-message-example--tf3642922.html#a10175198
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
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Is there a success message example?

2007-04-25 Thread Eelco Hillenius
 rofl, ok thats only three of the same response so far, lets see if we can
 rack up some more. i wish gmail could tell you that someone is responding to
 the same message you are. it does IM, why not this???

Gmail actually had the feature that showed you updates in the thread
while you are writing (updates must be submitted). But it seems they
rolled back that feature.

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
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Is there a success message example?

2007-04-25 Thread Eelco Hillenius
 // Fixed SiteMesh:
 http://spatula.net/blog/2006/10/wicket-sitemesh-feces-nocturnus.html

 getRequestCycleSettings().setRenderStrategy(IRequestCycleSettings.ONE_PASS_RENDER);

 It's likely be pretty easy to port when I have with SiteMesh to use the page
 extension stuff that Wicket has, but I'm lazy. ;-)

I see how SiteMesh can work with Wicket, and I even can imagine a
couple of useful use cases, but in general I believe people are
ruining their programming model by using it with Wicket.

My 2c,

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
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Is there a success message example?

2007-04-25 Thread mraible



Eelco Hillenius wrote:
 
 // Fixed SiteMesh:
 http://spatula.net/blog/2006/10/wicket-sitemesh-feces-nocturnus.html

 getRequestCycleSettings().setRenderStrategy(IRequestCycleSettings.ONE_PASS_RENDER);

 It's likely be pretty easy to port when I have with SiteMesh to use the
 page
 extension stuff that Wicket has, but I'm lazy. ;-)
 
 I see how SiteMesh can work with Wicket, and I even can imagine a
 couple of useful use cases, but in general I believe people are
 ruining their programming model by using it with Wicket.
 
 My 2c,
 
 Eelco
 

I agree that using Wicket's decoration mechanism is probably a better way to
go. One small question though - how do I put the contextPath into URLs in my
BasePage.html?  In my SiteMesh decorator, I have:

c:set var=ctx value=${pageContext.request.contextPath}/

link rel=shortcut icon href=${ctx}/images/favicon.ico
type=image/x-icon/
link rel=stylesheet type=text/css
href=${ctx}/styles/deliciouslyblue/theme.css title=default /
link rel=alternate stylesheet type=text/css
href=${ctx}/styles/deliciouslygreen/theme.css title=green /
script type=text/javascript
src=${ctx}/scripts/prototype.js/script
script type=text/javascript
src=${ctx}/scripts/scriptaculous.js/script
script type=text/javascript
src=${ctx}/scripts/stylesheetswitcher.js/script
script type=text/javascript src=${ctx}/scripts/global.js/script

Thanks,

Matt

-- 
View this message in context: 
http://www.nabble.com/Is-there-a-success-message-example--tf3642922.html#a10184929
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
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Is there a success message example?

2007-04-25 Thread Eelco Hillenius
 I agree that using Wicket's decoration mechanism is probably a better way to
 go. One small question though - how do I put the contextPath into URLs in my
 BasePage.html?  In my SiteMesh decorator, I have:

 c:set var=ctx value=${pageContext.request.contextPath}/

 link rel=shortcut icon href=${ctx}/images/favicon.ico
 type=image/x-icon/
 link rel=stylesheet type=text/css
 href=${ctx}/styles/deliciouslyblue/theme.css title=default /
 link rel=alternate stylesheet type=text/css
 href=${ctx}/styles/deliciouslygreen/theme.css title=green /
 script type=text/javascript
 src=${ctx}/scripts/prototype.js/script
 script type=text/javascript
 src=${ctx}/scripts/scriptaculous.js/script
 script type=text/javascript
 src=${ctx}/scripts/stylesheetswitcher.js/script
 script type=text/javascript src=${ctx}/scripts/global.js/script

It should be done automatically for you. Just do:

link rel=shortcut icon href=images/favicon.ico type=image/x-icon/
link rel=stylesheet type=text/css
href=styles/deliciouslyblue/theme.css title=default /
link rel=alternate stylesheet type=text/css
href=styles/deliciouslygreen/theme.css title=green /
script type=text/javascript src=scripts/prototype.js/script
script type=text/javascript src=scripts/scriptaculous.js/script
script type=text/javascript src=scripts/stylesheetswitcher.js/script
script type=text/javascript src=scripts/global.js/script

and all should work fine.

See PrependContextPathHandler for more info.

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
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] Is there a success message example?

2007-04-24 Thread mraible

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?

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, ));
}

Thanks,

Matt
-- 
View this message in context: 
http://www.nabble.com/Is-there-a-success-message-example--tf3642922.html#a10173842
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
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Is there a success message example?

2007-04-24 Thread Nick Heudecker

You can just add a FeedbackPanel to the Page:

add(new FeedbackPanel(feedback));

span wicket:id=feedback/span

Then call your info(...), error(...) or whatever method:

info(It Worked!);

I haven't worked with 1.3 yet, so I don't know if anything has changed
there.

On 4/24/07, mraible [EMAIL PROTECTED] 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?

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, ));
}

Thanks,

Matt
--
View this message in context:
http://www.nabble.com/Is-there-a-success-message-example--tf3642922.html#a10173842
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
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user





--
Nick Heudecker
Professional Wicket Training  Consulting
http://www.systemmobile.com

Eventful - Intelligent Event Management
http://www.eventfulhq.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
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Is there a success message example?

2007-04-24 Thread Eelco Hillenius
 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.

 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.

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
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Is there a success message example?

2007-04-24 Thread Igor Vaynberg

for a full crud app wicket+spring+hibernate/ibatis/shades see
wicket-phonebook project in wicket-stuff.sf.net
it has the feedback messages and grids you want.

also for models you can read here
http://cwiki.apache.org/confluence/display/WICKET/Working+with+Wicket+models

-igor


On 4/24/07, mraible [EMAIL PROTECTED] 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?

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, ));
}

Thanks,

Matt
--
View this message in context:
http://www.nabble.com/Is-there-a-success-message-example--tf3642922.html#a10173842
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
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-
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
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Is there a success message example?

2007-04-24 Thread mraible



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
 Wicket-user@lists.sourceforge.net
 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#a10174556
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
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Is there a success message example?

2007-04-24 Thread mraible

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
 Wicket-user@lists.sourceforge.net
 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
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Is there a success message example?

2007-04-24 Thread Igor Vaynberg

On 4/24/07, mraible [EMAIL PROTECTED] wrote:



 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.



what eelco meant to say is that wicket does redirect-after-post for you by
default, thus no need for you to bother with it.

-igor
-
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
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user