I'm using a TagLib, but it is presenting a weird behaviour, instead of output character like <
, "
, and >
it outputs <
, "
, and >
.
the code:
class LoginTagLib {
static defaultEncodeAs = [taglib:'html']
//static encodeAsForTags = [tagName: [taglib:'html'], otherTagName: [taglib:'none']]
def loginControl =
{
if(session.user)
{
out << "Hello ${session.user.name}"
out << """[${link(action:"logout", controller:"user"){"Logout"}}]"""
}
else
{
out << """[${link(action:"login", controller:"user"){"Login"}}]"""
}
}
}
in the .gsp I've got
<g:loginControl />
When I open the page I have:
Hello Jane Smith[<a href="/Blogito/user/logout">Logout</a>]
but the page's source code is:
<div id="loginHeader">
Hello Jane Smith[<a href="/Blogito/user/logout">Logout</a>]
</div>
I've tried using .encodeAsHTML()
, decodeHTML
, .replace('>', '<')
and nothing has worked so far
Remove this line:
static defaultEncodeAs = [taglib:'html']
and try again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With