开发者

Displaying parsed HTML output using Velocity

i have a velocity template...

It contains the following tag:

#field('itemname')

The "itemname" variable contains this:

<i>Some</i> <b>Example Title</b>

T开发者_如何学Gohe source of the outputted page has this:

<i>Some</i> <b>Example Title</b>

So, the user sees the actual HTML tags:

<i>Some</i> <b>Example Title</b>

What I want them to see is:

Some Example Title

Where am I going wrong?


If I see right from your snippets, the problem is not with the velocity template, but with the mime type encoding of the HTTP Response your user is receiving. It should be "text/html", but I suspect it's something else, and so, the browser is showing the tags instead of "rendering" them to what they represent.

Of course, I don't know what your

#field()
macro does, so the problem might be something else, e.g. that macro might generate a wrapping PRE tag or a Text Area, and this might be the cause you why the those B and I tags are displayed as they are instead of being rendered.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜