Menu

how to render html tags properly

Help
organ
2014-04-07
2014-04-10
  • organ

    organ - 2014-04-07

    Hi folks,
    My java class passes a string with html tags such as test (with bold tags)I wonder what should I do on the freemarker side to render 'test' as bold? I tried escape/no escape on freemarker and they didn't work. The string comes from java always renders literally instead of rendering as html tags.
    I tried StringEscapeUtils.escapeHtml in java but ftl will display with 'less than' 'greater than' symbols.
    Any suggestions? Thanks!

     
  • Dániel Dékány

    ${myVar} will insert any HTML content as is, unless you are inside an #escape. So I'm not sure what's going on there. What will ${'<b>foo</b>'} print? And <#noescape>${'<b>foo</b>'}</#noescape>?

     

Log in to post a comment.