I have something like:
Locale defaultLocale = Locale.getDefault();
final Context ctx = new Context(defaultLocale);
String url = getHost() + "/page?someId=" + some.getId() + "&someParam=" + Boolean.TRUE;
ctx.setVariable("url", url);
final String htmlContent = templateEngine.process("theHtmlPage", ctx);
But when I look at the resulting HTML to print url
, it shows &
instead of &
in the URL.
Any suggestions?
I tried using backticks to escape the ampersand in the Java code, but it just printed those too. Looked around on SO, but didn't find much that was relevant. Also tried &
Update: Ok, this won't break the link, but Spring doesn't seem to resolve the parameter "someParam" as true without it.
Rendering tag:
<span th:utext="${url}"></span>
Output:
<span>http://localhost:8080/page?someId=1&someParam=true</span>