You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Joshua Jackson <jo...@gmail.com> on 2007/10/05 11:54:28 UTC
T4: Message component, is there any?
Dear all,
Is there any Message component in T4 for displaying messages on pages
upon success or failed process? Or should I use Insert component
instead?
Thanks in advance.
--
It's not just about coding, it's a matter of fulfilling your core being
YM!: thejavafreak
Blog: http://joshuajava.wordpress.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T4: Message component, is there any?
Posted by Geoff Callender <ge...@gmail.com>.
I don't know of one. It's common to make your own, eg. ShowError.html:
<span jwcid="$content$">
<span jwcid="@If"
condition="ognl:page.beans.validationDelegate.hasErrors">
<span class="error">
<span jwcid="@Delegator"
delegate="ognl:page.beans.validationDelegate.firstError">Error
Message</span>
</span>
</span>
</span>
and perhaps a more generalised message component, eg. ShowMessages.html:
<span jwcid="$content$">
<span jwcid="@If"
condition="ognl:page.beans.validationDelegate.hasErrors">
<span jwcid="@ShowError">--- Validation error message ---</span>
</span>
<span jwcid="@If" condition="ognl:page.warningMessage">
<span jwcid="@Insert" value="ognl:page.warningMessage"
class="warning">--- Warning message ---</span>
</span>
<span jwcid="@If" condition="ognl:page.infoMessage">
<span jwcid="@Insert" value="ognl:page.infoMessage"
class="info">--- Info message ---</span>
</span>
</span>
Don't forget to create ShowError.jwc and ShowMessages.html, both of
which would look like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE component-specification PUBLIC
"-//Apache Software Foundation//Tapestry Specification 4.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
<component-specification allow-informal-parameters="no">
</component-specification>
BTW, getters and setters for warningMessage and infoMessage are
typically put in a common superclass of your pages so that every page
can use them.
HTH,
Geoff
http://files.doublenegative.com.au/jumpstart
On 05/10/2007, at 7:54 PM, Joshua Jackson wrote:
> Dear all,
>
> Is there any Message component in T4 for displaying messages on pages
> upon success or failed process? Or should I use Insert component
> instead?
>
> Thanks in advance.
>
> --
> It's not just about coding, it's a matter of fulfilling your core
> being
>
> YM!: thejavafreak
> Blog: http://joshuajava.wordpress.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>