You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Irfandhy Franciscus <en...@yahoo.com.sg> on 2004/06/20 16:09:52 UTC

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


Re: Displaying html tag as html with bean:write

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
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" <en...@yahoo.com.sg>
To: <us...@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


Bi-dimensional indexed properties

Posted by Renato Romano <r....@set-network.com>.
I need to define a form which has a 2-dimensional indexed property; I
tried defining a setter method of the form setXXX(i, j, val) but it
seems that struts only recognises 1 level indexed properties; in fact
what happens is that the value of my property is the entire row (it is
shown as ["someString", "someOtherString", ... ]. I also tried with the
list-backed approach, that is a setter/getter method for a single
property of type List), but the result is identical.
In fact my matrix is not dynamic, so I could have n x m single
properties, but accessing it as a matrix is still useful...
Any help is very appreciated.

Renato

____________________________________
Renato Romano
Sistemi e Telematica S.p.A.
Calata Grazie - Vial Al Molo Giano
16127 - GENOVA

e-mail: r.romano@set-network.com
Tel.:   010 2712603
_____________________________________


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