[tools] Using java.text.MessageFormat in templates

Christopher Schultz <[email protected]> Fri, 21 Feb 2014 12:48:13 -0500
Newsgroups gmane.comp.jakarta.velocity.user
Message-ID <[email protected]>
All,

I have a template where I'd like to take some text in a variable and do
parametric-replacement like new
MessageFormat("format").format(replacements) might do.

I'm already using Velocity Tools/Struts to great effect with pre-defined
messages in properties files, but this data needs to come from a
database and I'd rather not pre-process the data in Java code unless
absolutely necessary.

I've browsed through the tools available from Velocity Tools and I don't
really see anything that would meet my needs. I even looked at ClassTool
to see if I could instantiate an object through brute-force and it looks
like that is not possible.

Is there a stock tool I can use, or will I have to write my own?

Thanks,
-chris
signature.asc (application/pgp-signature, 924 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJTB5FdAAoJEBzwKT+lPKRYyXIP/jVhpsnsLyYSI64SMO9hwjOM
KPoqNcSB5ezIGF0M3lZ57CBCgCK1Zam30grWjt/N8mieKVigWfUxrkADWFbj/bsP
cz9bbLw7LPle7ITyGBLZNDUOil4Bpzg9tNz61etKMxEt8IneK0haadVBhs6DQnP1
rF2lrvlOmSMMBx6vUg7y0QLO3+g0DQ0u049xJG9C5ORpFfMPycSF8UzhSJ7X2KVQ
COlMah6eNimeVonXOjmbPWhsIcfzTX6JlWP7iihGiDymlF0sojqhshIZbuo5j4hr
LeKE5EECKjUlRmzF5IDE350oFj0CH8Lecnw+jYoRAwcShwngk0Ag32dK6yphHQM4
h/e6TQ9hLTBx3Llwix+083dDPu1krlov5ZpNDrtOnxXrrWGfItMuuLSKcu/AX2UO
nq6y+s1f0w66Hcr3CWhqRHcC8A+80cImMiyJU7fnrg8sRy2mWy+6rIEjVqRZHeH9
+rOjM8FUucmyysgnQYv8T4DwMqyJGNBzn70O6hIQ2T5hZ4Iz0128DGxFXOXVH2aE
ZzpWyDpIAeXDQF5xysOd6v8JmJUgfGGoeWL24nnd88ixMbFITbAIUSP2MkmR2UFW
O/34yV5dN5NlOzGm2UT8Sw5dxXifG5TmulX7VFG3Pfkc5ccgoA4RVPoTi3Hij+Fp
AIHAdFfZpAvLCvfpsFGA
=Sd0D
-----END PGP SIGNATURE-----