You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by "Paananen, Tero" <Te...@GTECH.COM> on 2003/04/22 18:48:40 UTC

bean:message with references to other messages

We just implemented references using the bean:message
tag.

We have functionality in our application that sort
of stretches the entire scope of the application and
is using messages that are already defined for other
UI screens. Our functionality in question is too
generic to directly use the messages defined for the
other screens.

So we implemented references with the bean:message tag:

// works like usual
foo.bar.1=This is a regular message
// refers to the above message
foo.bar.reference=^foo.bar.1
// reference to a reference, outputs foo.bar.1 in the UI
foo.bar.ref.ref=^foo.bar.reference
// ref to a ref to a ref (you get the point)
foo.bar.ref.ref.ref=^foo.bar.ref.ref


Message resources with values starting with the caret
("^") (could be any String, actually, but that's the
way we implemented it to mimic how ATG Dynamo does the
same thing) act as references. The current implementation
is not checking or preventing people from defining circular
references.

This way we're able to reuse existing messages already
defined and customers do not need to maintain the
same message in multiple places, like this:

generic.functionality.message1=^specific.functionality.what.ever

Would people be interested enough in this solution
to have it part of Struts?

Thanks,

Tero Paananen
GTECH

-----------------------------------------
This email may contain confidential and privileged material for the sole use of the intended recipient(s). Any review, use, retention, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message.  Also, email is susceptible to data corruption, interception, tampering, unauthorized amendment and viruses. We only send and receive emails on the basis that we are not liable for any such corruption, interception, tampering, amendment or viruses or any consequence thereof.


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


Re: bean:message with references to other messages

Posted by James Mitchell <jm...@apache.org>.
I was considering something similar for database implementation of
MessageResources, but I haven't moved on it yet.  The biggest difference
would be my using ${this.fomat} instead of ^this.format.  I also want to
guard against circular references as well.

--
James Mitchell
Software Developer/Struts Evangelist
http://www.open-tools.org



----- Original Message -----
From: "Paananen, Tero" <Te...@GTECH.COM>
To: <st...@jakarta.apache.org>
Sent: Tuesday, April 22, 2003 12:48 PM
Subject: bean:message with references to other messages


> We just implemented references using the bean:message
> tag.
>
> We have functionality in our application that sort
> of stretches the entire scope of the application and
> is using messages that are already defined for other
> UI screens. Our functionality in question is too
> generic to directly use the messages defined for the
> other screens.
>
> So we implemented references with the bean:message tag:
>
> // works like usual
> foo.bar.1=This is a regular message
> // refers to the above message
> foo.bar.reference=^foo.bar.1
> // reference to a reference, outputs foo.bar.1 in the UI
> foo.bar.ref.ref=^foo.bar.reference
> // ref to a ref to a ref (you get the point)
> foo.bar.ref.ref.ref=^foo.bar.ref.ref
>
>
> Message resources with values starting with the caret
> ("^") (could be any String, actually, but that's the
> way we implemented it to mimic how ATG Dynamo does the
> same thing) act as references. The current implementation
> is not checking or preventing people from defining circular
> references.
>
> This way we're able to reuse existing messages already
> defined and customers do not need to maintain the
> same message in multiple places, like this:
>
> generic.functionality.message1=^specific.functionality.what.ever
>
> Would people be interested enough in this solution
> to have it part of Struts?
>
> Thanks,
>
> Tero Paananen
> GTECH
>
> -----------------------------------------
> This email may contain confidential and privileged material for the sole
use of the intended recipient(s). Any review, use, retention, distribution
or disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact the
sender by reply email and delete all copies of this message.  Also, email is
susceptible to data corruption, interception, tampering, unauthorized
amendment and viruses. We only send and receive emails on the basis that we
are not liable for any such corruption, interception, tampering, amendment
or viruses or any consequence thereof.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-dev-help@jakarta.apache.org


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