简体   繁体   English

Java-捕获html标签

[英]Java - Capture html tags

I have a Richtexteditor in my web application, I am allowing only Bold, Italics and Underline options for the user. 我的Web应用程序中有一个Richtexteditor,我只允许用户使用粗体,斜体和下划线选项。

From a word document, the user can copy another text or paragraph which has Bullets, Alignments, Indentation etc. 用户可以从Word文档中复制具有项目符号,对齐方式,缩进等的其他文本或段落。

Is there any way I can restrict the copying of texts or paragraphs which has Bullets, Alignments, Indentation? 我有什么办法可以限制带有项目符号,对齐方式,缩进的文本或段落的复制? At the time of submitting the page, can I check the HTML tags which the above using Java? 提交页面时,我可以使用Java检查上面的HTML标签吗?

You could use jsoup 您可以使用jsoup

String unsafe = "<p><a href='http://example.com/' onclick='stealCookies()'>Link</a></p>";
String safe = Jsoup.clean(unsafe, Whitelist.basic());
// now: <p><a href="http://example.com/" rel="nofollow">Link</a></p>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM