Here is my requirement. I have a textbox & user can type anything in the textbox and the system will convert it into html. However, it only converts
<b> or <i> tag & ignore all other tags. The result of that text will be put into
Ex, user typ in textbox:
<h1>text <i>test</i></h1> it will out put:
So if user types
<h1> in the text box then the system should be smart enough to know that it should escape that
<h1> but then it has to put
<h1> to the final string.
The code could be like this. I use SimpleHtmlSanitizer to sanitize string & only allows
<b> or <i>
SafeHtml mySafeHtml=MySimpleHtmlSanitizer.sanitizeHtml("<h1>text <i>test</i></h1>");
so, if i print out mySafeHtml, then it will show like this:
But Then how to make that String embraced inside tag?
SafeHtmlBuilder builder = new SafeHtmlBuilder(); builder.appendHtmlConstant("<h1>"); builder.appendEscaped(mySafeHtml); // err here cos SafeHtmlBuilder does not excapse SafeHtml? builder.appendHtmlConstant("</h1>");
So how to solve my problem?
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firstname.lastname@example.org.
To post to this group, send email to email@example.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.