注:若需要被静态化的 页面中 使用了 response.sendRedirect跳转,则最后静态页面为 最终跳转后的页面。
而那些 使用js 跳转的 比如 window.location.href 则 无效,直接作为js代码在生成的静态页面中,并执行。
//保存为文件
import java.io.*;public class GenerateIndexPage { protected static String defaultToFile = "frame/main_Null.html"; protected static String defaultFromFile = "http://localhost:8080/stfb/frame/main_Null.jsp"; String result = ""; public String genHtml(String fromFile,String toFile) throws Ex

本文介绍了如何使用Java的HttpURLConnection类读取网页内容并生成静态页面。若网页中使用response.sendRedirect进行跳转,静态页面将指向跳转后的内容。但js跳转如window.location.href则不会生效,会在生成的页面中作为js代码执行。
最低0.47元/天 解锁文章
613

被折叠的 条评论
为什么被折叠?



