2

I am looking for a way to take a string like: "pleas take this ${date.object}." and a dictionary that has the key "object"

and replacing as EL does.

i.e. if "object"=>"bag" then I want to get the string "pleas take this bag."

I know I can do this using explicit string replacement but was looking for a way to utilize the same engine used by EL.

epeleg
  • 10,347
  • 17
  • 101
  • 151
  • 3
    See http://stackoverflow.com/questions/91692/jstl-jsp-el-expression-language-in-a-non-jsp-standalone-context – Sahil Muthoo Oct 17 '11 at 07:29
  • 1
    Is this in the context of a Java web application executed by a Servlet Engine, or in some standalone application? – erickson Oct 17 '11 at 07:37

1 Answers1

3

MessageFormat does something similuar. May be you can use this?

Example:

 MessageFormat.format("pleas take this {0} or may be this {1}", object, object2);
Markus Lausberg
  • 12,177
  • 6
  • 40
  • 66