我在做java开发,我在后天生成了个html,如何让其通过servlet来展现...

发布网友 发布时间:2024-10-23 21:51

我来回答

2个回答

热心网友 时间:2024-10-26 06:19

public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

response.setContentType("text/html");
PrintWriter out = response.getWriter();
out
.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
out.println(" <BODY>");
out.print(" This is ");
out.print(this.getClass());
out.println(", using the POST method");
out.println(" </BODY>");
out.println("</HTML>");
out.flush();
out.close();
}

这是servlet 向外跳转的一个参考,你可以看看 http://panlianghui-126-com.iteye.com/blog/730262

热心网友 时间:2024-10-26 06:21

用流往外写

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com