struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton" <niall.pember...@blueyonder.co.uk>
Subject Re: Displaying html tag as html with bean:write
Date Sun, 20 Jun 2004 15:37:03 GMT
By default <bean:write> 'filters' special html characters converting them to
their 'entity' types so that they render properly - for example '<' is
converted to '&gt;'

You can switch it off using the filter="false" attribute.

  <bean:write name="..." filter="false"/>

The JSTL equivalent  <c:out>  tag also has an attribute which performs the
same function. I think its "escapeXML"

However if your user really does want to see, for example, the greater than
character then they will have to type in &gt; themselves.

Niall

----- Original Message ----- 
From: "Irfandhy Franciscus" <enulljlist@yahoo.com.sg>
To: <user@struts.apache.org>
Sent: Sunday, June 20, 2004 3:09 PM
Subject: Displaying html tag as html with bean:write


> Hi All,
>
> I am developing a hibernate-struts base blog. And I would like to have
> my user to be able to use html tag such as : <br/> ;&nbsp etc in their
> posts.
>
> The database field that I use to save the user post is in BLOG.
>
> To display their post I use <bean:write/> tag. The problem with this tag
> is that it render the html tag as a string in the page. So if the user
> enters :
>
> 'My post on 20 June <br/>;&nbsp' it will display 'My post on 20 June
> <br/>;&nbsp' in the page.
>
> Okay to get around this problem I use the old good <%=out.println(...)%>
> . It display the post as 'My Post on 20 June ;'. Everything is perfect
> except for the ';' at the end of the post.
>
> Does anyone know how to ge around this problem. Thanks for the help :D
>
> Regards,
> Irfandhy Franciscus
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message