I\'m trying to pass a simple URL to a view within a play framework app, however when passed as a string, the &
in the url is changed to &
w
To prevent the default escaping that happens for dynamic content on views you need to wrap the String
with @Html(String)
function:
View:
@(url: String)
Go to: @Html(url)
not to: @url
Controller:
public static Result displayLink(){
return ok(view.render("Stack Overflow"));
}
See The template engine page on the documentation for more info (specifically the "Escaping" section at the very bottom).