You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Kaja Mohideen <ka...@yash.com> on 2005/03/07 21:30:29 UTC

Hi,
    I wanted to display label using <bean:write filter="false">. But I
need to filter(or allow) selected HTML tag. For example I have to allow
<code></code> tag but I have to filter <script>alert("hi");</script>
like that.. Can we do this selective filtering using any tag libraries,,
otherwise I have to extend existing tag libraries..Please help me out
here..

Thanks,
Kaja




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


Re:

Posted by Jeff Beal <jb...@gmail.com>.
Where do the contents of the bean you are writing come from?  Is this
something like a message board where users are posting content with
HTML formatting, and you want to be sure they're not uploading scripts
for security reasons?  If that's the case, I'd be sure to filter out
any <script/> tags when the user first posts the HTML.  That way, you
know that the system never has any invalid HTML in the database.

If you have a case where you want to store the <script/> tag, but only
display it in certain situations, you'll need to use a different
custom tag.  I'm not aware of an existing one that filters out
selective HTML content, but there may be one.  Writing your own
shouldn't be that hard.

-- Jeff


On Mon, 7 Mar 2005 15:30:29 -0500, Kaja Mohideen <ka...@yash.com> wrote:
> Hi,
>     I wanted to display label using <bean:write filter="false">. But I
> need to filter(or allow) selected HTML tag. For example I have to allow
> <code></code> tag but I have to filter <script>alert("hi");</script>
> like that.. Can we do this selective filtering using any tag libraries,,
> otherwise I have to extend existing tag libraries..Please help me out
> here..
> 
> Thanks,
> Kaja
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


-- 
Jeff Beal
Webmedx, Inc.
Pittsburgh, PA USA

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