You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mike Elliott <st...@m79.net> on 2004/08/16 11:44:15 UTC

HTML Filtering?

I have a situation where I need to populate a table with values.  Sometimes 
those values are empty.  Mozilla, for reasons outside of this discussion will 
not fully render a table datum that is empty; that is, it will render nothing 
(correctly) but also not render the border of the table datum either, if the 
content is empty.

Normally the workaround for this is to put a non breakable space (&nbsp;) in 
the table datum to get Mozilla (or Netscape, for that matter) to render the 
table datum with all surrounding borders.  However, Struts makes that 
difficult.

If I use a <bean:write> tag, I can specify filtering off to allow the &nbsp; 
non breakable space to appear.  That will, however, prevent the filtering of 
non-empty items as well -- which might not be such a good idea.  Or, I can 
turn on filtering which will cause oddball elements to be rendered correctly, 
but will prevent the &nbsp; from being a non-breakable space.

So . . . what I need to do is perform the filtering beforehand, then set the 
bean to render the property with no filtering (filtering="false").  That 
means I need to do my own filtering.  Yes, I can write my own HTML filtering 
routine, but . . . there must be something already out there - probably part 
of the commons-beanutils jar file - that already does such filtering.  I'd 
much rather use that than roll my own.

Anyone know of such a routine?  That is, a routine invokable from within an 
arbitrary class, that takes a chunk of text and renders ampersands as &amp;, 
left angle brackets as &lt; etc.?

--
Mike Elliott

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


Re: HTML Filtering?

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
org.apache.struts.taglib.TagUtils.filter(String)

Niall

----- Original Message ----- 
From: "Mike Elliott" <st...@m79.net>
To: <us...@struts.apache.org>
Sent: Monday, August 16, 2004 10:44 AM
Subject: HTML Filtering?


> I have a situation where I need to populate a table with values.
Sometimes
> those values are empty.  Mozilla, for reasons outside of this discussion
will
> not fully render a table datum that is empty; that is, it will render
nothing
> (correctly) but also not render the border of the table datum either, if
the
> content is empty.
>
> Normally the workaround for this is to put a non breakable space (&nbsp;)
in
> the table datum to get Mozilla (or Netscape, for that matter) to render
the
> table datum with all surrounding borders.  However, Struts makes that
> difficult.
>
> If I use a <bean:write> tag, I can specify filtering off to allow the
&nbsp;
> non breakable space to appear.  That will, however, prevent the filtering
of
> non-empty items as well -- which might not be such a good idea.  Or, I can
> turn on filtering which will cause oddball elements to be rendered
correctly,
> but will prevent the &nbsp; from being a non-breakable space.
>
> So . . . what I need to do is perform the filtering beforehand, then set
the
> bean to render the property with no filtering (filtering="false").  That
> means I need to do my own filtering.  Yes, I can write my own HTML
filtering
> routine, but . . . there must be something already out there - probably
part
> of the commons-beanutils jar file - that already does such filtering.  I'd
> much rather use that than roll my own.
>
> Anyone know of such a routine?  That is, a routine invokable from within
an
> arbitrary class, that takes a chunk of text and renders ampersands as
&amp;,
> left angle brackets as &lt; etc.?
>
> --
> Mike Elliott
>
> ---------------------------------------------------------------------
> 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