You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by The Chris Method <th...@gmail.com> on 2005/03/15 18:22:32 UTC

error and update messages

We have two kinds of messages that we frequently display to users:
error and update messages.  Right now there are perhaps 40 pages that
all have two string page properties that are used for this.  We are
trying to come up with a better way to manage this.

At first I had thought that we'd just encode the messages into the
RequestCycle as attributes.  The only time we seem to set these
messages is at form rewind time and we use them as the page is
rendering again, so it seemed perfect.  Well, except for the fact that
the page rendering clears all the RequestCycle's attributes.

What other options do we have?  It'd just be nice to not have to add
these properties to every page specification and page class.

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: error and update messages

Posted by Steve Lianoglou <li...@binkabi.info>.
This is what I did.

I put 2 vars in my own BasePage class:

String _errorMessage;
String _actionMessage; // for normal updates / "Hey .. do this!" on a 
page if it needs it

These props are not defined in any *.page descriptor/file/what-have-you 
... (don't know if that's a good or bad thing, but that was my first 
whack at it and the implementation is trivial enough)

Since they're not in any .page files, I have to zero those out when I'm 
done w/ the page, so the initialize() method of the BasePage class just 
sets those back to null so the next time the page is used from the 
pool, we won't have any messages in there from another user/request.

The subpages that need to set something just do so via the setters 
(again, defined in the BasePage class) and .... blamo, it seems to be 
working fine ... the app is still under production though, so if any of 
the more experience folk around here see a problem with that, I'd be 
happy to hear that too :-)

I have a widget in my border class that checks to see if the page is 
tryingToNotify() -- which checks to see if those messages are null or 
not, and then displays a message-widget if there's something the page 
is trying to say.

Hope that helps,

-steve


On Mar 15, 2005, at 9:22 AM, The Chris Method wrote:

> We have two kinds of messages that we frequently display to users:
> error and update messages.  Right now there are perhaps 40 pages that
> all have two string page properties that are used for this.  We are
> trying to come up with a better way to manage this.
>
> At first I had thought that we'd just encode the messages into the
> RequestCycle as attributes.  The only time we seem to set these
> messages is at form rewind time and we use them as the page is
> rendering again, so it seemed perfect.  Well, except for the fact that
> the page rendering clears all the RequestCycle's attributes.
>
> What other options do we have?  It'd just be nice to not have to add
> these properties to every page specification and page class.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org