Tag:Method of generating static page by JSP

  • Method of generating static page by JSP

    Time:2021-10-24

    Copy codeThe code is as follows: import java.io.ByteArrayOutputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponseWrapper; public class toHtml extends HttpServlet {     public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException     {     String url=””;     String name=””;         ServletContext sc = getServletContext();          String   file_ name=request.getParameter(“file_name”);// The JSP file you want to access, such as index.jsp  // Then you add parameters when accessing this servlet. For example http://localhost/toHtml?file_ name=index          url […]