views:

51

answers:

1

Hello

I have a situation where users can submit feedback through a textarea on a HTML page or JSP. This works fine and the text ends up in the database.

But, can anyone suggest any safeguards which could prevent somebody trying to submit malicious scripts which could possibly affect the page's behaviour?

I am aware of parsing the text entered and converting any < to '&LT'; and > to '&GT'; But is there anything more I could do to validate the entered text?

Thanks

Mr Morgan

A: 

Check this out: http://stackoverflow.com/questions/1265282/recommended-method-for-escaping-html-in-java

See Apache StringEscapeUtils

escapeJavaScript and escapeHtml

Joelio
Many thanks. This looks to be what I need.
Mr Morgan