can freemarker do second replacement

懵懂的女人 提交于 2019-12-11 00:14:31

问题


Usually i use this type of data in freemarker:

(root)  
|  
+- website = "StackOverflow"  
|  
+- href = "http://stackoverflow.com"  
|  
+- label = "my favorite website."

but today,a java programmer give me a model like this:

(root)  
|  
+- website = "StackOverflow"  
|  
+- href = "http://stackoverflow.com${dir}"  
|  
+-  label = "my favorite website"  
|  
+- dir = "/questions/ask"

And he wants me to show dir's value in the final page. The template:

${label}<a href="${href}" >${website}</a>

i suggested him to write a template like this

${label}<a href="${href}${dir}" >${website}</a>

but he dont want to do like this.I want to ask if there any way to realize this requirement.


回答1:


${label}<a href="<@href?interpret/>" >${website}</a>

this is the answer



来源:https://stackoverflow.com/questions/3131093/can-freemarker-do-second-replacement

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!