public static String regEx_script = "<script[^>]*?>[\\s\\S]*?<\\/script>";
public static String regEx_style = "<style[^>]*?>[\\s\\S]*?<\\/style>";
public static String regEx_html = "<[^>]+>";
public static Pattern p_style = Pattern.compile(regEx_style, Pattern.CASE_INSENSITIVE);
public static Pattern p_script = Pattern.compile(regEx_script, Pattern.CASE_INSENSITIVE);
public static Pattern p_html = Pattern.compile(regEx_html, Pattern.CASE_INSENSITIVE);
public static String getOptimizedData(String inputString) {
if (inputString == null) {
return inputString;
}
//stripping script tags whether the tag contains "\n" or "\r" or not.
Matcher m_script = p_script.matcher(inputString);
String htmlStr = m_script.replaceAll("");
//stripping style tags whether the tag contains "\n" or "\r" or not.
Matcher m_style = p_style.matcher(htmlStr);
htmlStr = m_style.replaceAll("");
//stripping html tags but continue to have the "\n" and "\r" in right place.
Matcher m_html = p_html.matcher(htmlStr);
htmlStr = m_html.replaceAll("");
return htmlStr;
}
分享到:
相关推荐
初学者用java编写的,用以移除网页源代码中的各类tags。
JSP技术使用Java编程语言编写类XML的tags和scriptlets,来封装产生动态网页的处理逻辑。网页还能通过tags和scriptlets访问存在于服务端的资源的应用逻辑。JSP将网页逻辑与网页设计和显示分离,支持可重用的基于组件...
JSP技术使用Java编程语言编写类XML的tags和scriptlets,来封装产生动态网页的处理逻辑。网页还能通过tags和scriptlets访问存在于服务端的资源的应用逻辑。JSP将网页逻辑与网页设计和显示分离,支持可重用的基于组件...
就是几个html tag,初学者看看不错的
java web 标签大全,包括1、struts 1 各类型标签;2、struts 2 标签;3、jstl 各类型标签;4、spring 标签;5、jsf标签;6、jsp标签、语法;7、freemarker语法;8、velocity语法;9、ajax常用函数;10、常用js表单...
这是我的自己定的一个分页用的组件 可以用jsp脚本和jsp标签实现 不是很完美,但够用了
Component Tags Chapter 4 : RESTful Web Services Resources Binding HTTP Methods Multiple Resource Representations Binding a Request to a Resource Entity Providers Client API Mapping ...
Web Development with Java... Its no-nonsense presentation style and useful examples can help put JSP development into the hands of anyone who has some prior HTML or Java experience. --Richard Dragan
And, from the server-side, this book covers servlets, JavaServer Pages (JSPs), database accessibility (JDBC), custom tags, and concludes with JavaServer Faces (JSFs). This book concentrate on base ...
本文实例讲述了php使用strip_tags()去除html标签仍有空白的解决方法。分享给大家供大家参考,具体如下: $subject = strip_tags($newsRs['content']);//去除html标签 $pattern = '/\s/';//去除空白 $content = preg...
软件介绍 李刚《疯狂Java讲义》随书PPT,主要介绍Java概况。 Tags: Java教程 Java教程下载 Java
JSP技术使用Java编程语言编写类XML的tags和scriptlets,来封装产生动态网页的处理逻辑 MySQL是Java编写的服务器端程序,是由服务器端执行和调用的Java类。MySQL是采用Java技术来实现CGI功能的一种技术,能够像CGI...
Javadoc 8 标签该项目为提供了关于新的 Javadoc 标签@apiNote 、 @implSpec和@implNote的代码示例,这些标签首先在 Java 8 中使用。 这包括: 使用它们的接口 显示如何继承标签的类: 没有实现默认方法~> 该方法在类...
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix=...
TagsInput 是一种可编辑的输入框,通过回车或者分号来分割每个标签,用回退键删除上一个标签。用 vue 来实现还是比较简单的。 先看效果图,下面会一步一步实现他。 注:以下代码需要vue-cli环境才能执行 (一)伪造...
基于tags的文本分类,使用KNN, Naive Bayes, Softmax(使用java)
搜索引擎和 HTML Meta 标签(Meta Tags)
软件介绍 同人类任何语言一样,Java为我们提供了一种表达思想的方式。如操作得当,同其他方式相比,随着问题变得愈大和愈复杂,这种表达方式的方便性和灵活性会显露无遗。...Tags: Java Java教程 Java编程
Adding Components to a Page Using HTML Tags 114 Using Core Tags 143 Chapter 8: Using Converters, Listeners, and Validators 145 Using the Standard Converters 145 Registering Listeners on ...
CPP_C++_Reference.chm CSS2.0中文手册.chm ...JAVA中文_API.CHM JDK_API_1_6_zh_CN.CHM.lnk Jsp帮助文档.chm Jsp精华文章.chm Struts-api(已更新,含TAGS).CHM Struts2.chm tomcat-docs(Servlet&JSP API).CHM