Question

I Used MessageFormat to format the contents of a file with parameters and get so a formated string with correct parameters. (I used it to format email body.finally I had one file per email body, the application needs to send a lot of different emails, so I got a lot of preformatted body files)

So far, I had six parameters.

Problem: Things are changing and now I have more than 6 parameters today ....

I realize that MessageFormat is limited to 6 parameters!

What can I do? Is there an alternative to MessageFormat? or the only solution is to put each email line in properties ( and hope not to have more than 6 per line parameters !) Thanks, Christophe.

Was it helpful?

Solution

since you've tagged this as 'spring' you could use the Apache Velocity templating engine (VelocityEngineFactoryBean), wire it into your class as a VelocityEngine.

You could then use VelocityEngineUtils.mergeTemplateIntoString() passing the name of the template file (stored in your classpath)

OTHER TIPS

Use a templating library. Freemarker for example.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top