You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Juan Alvarado (Struts List)" <ju...@manduca.com> on 2002/08/23 23:11:24 UTC
MessageResources in standalone app
Is there any way to use the functionality of replacement in message
resources outside of the struts environment.
I find the replace capabilities very useful in other apps and was wondering
if anyone knew how to accomplish this.
Thanks
**********************************************
Juan Alvarado
Internet Developer -- Manduca Management
(786)552-0504
jalvarado@manduca.com
AOL Instant Messenger: juan2000@aol.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: MessageResources in standalone app
Posted by "Todd G. Nist" <tn...@bellsouth.net>.
Juan,
Use the java.text.MessageFormat class. Below is a simple example, currently
it will print "Current Page: 123" if you add {1} then you will get "Current
Page: 123 of 789". Arguments are 0 based.
Regards,
Todd G. Nist
import java.text.MessageFormat;
public class MessageUtil {
public MessageUtil() {
}
public static void main (String argv[]) {
Object[] args = new Object[2];
args[0] = (Object)"123";
args[1] = (Object)"of 789";
MessageFormat mf = new MessageFormat("Current Page: {0} ");
String result = mf.format(args);
System.out.println(result);
}
}
-----Original Message-----
From: Juan Alvarado (Struts List) [mailto:juan_alvarado@manduca.com]
Sent: Friday, August 23, 2002 5:11 PM
To: Struts
Subject: MessageResources in standalone app
Is there any way to use the functionality of replacement in message
resources outside of the struts environment.
I find the replace capabilities very useful in other apps and was wondering
if anyone knew how to accomplish this.
Thanks
**********************************************
Juan Alvarado
Internet Developer -- Manduca Management
(786)552-0504
jalvarado@manduca.com
AOL Instant Messenger: juan2000@aol.com
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>