String replacement in java, similar to a velocity template

前端 未结 8 1372
小鲜肉
小鲜肉 2020-11-28 04:59

Is there any String replacement mechanism in Java, where I can pass objects with a text, and it replaces the string as it occurs.
For example, the text is :

8条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-28 05:28

    There are a couple of Expression Language implementations out there that does this for you, could be preferable to using your own implementation as or if your requirments grow, see for example JUEL and MVEL

    I like and have successfully used MVEL in at least one project.

    Also see the Stackflow post JSTL/JSP EL (Expression Language) in a non JSP (standalone) context

提交回复
热议问题