我现在可以在out.println("");中输出一个页面
out.println("<html>");
想问一下,如何将其中的html语句直接写到jsp文件中,然后Response直接输出这个页面
不是,这是直接在响页面上输出了一个字符串 html ,而不是你理解的 html 页面。
如果需要返回一个页面,直接重定向到一个 jsp 页面就可以了,基本语法:
response.sendRedirect(URL url);
第一种,自己新建一个a.jsp,然后在你逻辑中直接response.sendRedirect("a.jsp");
第二种,不新建jsp,通过out直接打印完整的jsp,例如
StringBuffer sb = new StringBuffer();
sb.append("");
sb.append("
sb.append("
");sb.append("");
out.println(sb);
1、out.write(" 定向地址");
2.response.sendRedirect("../index.jsp");
3. request.getRequestDispatcher("../index.jsp").forward(request, response);
4.或者说你可以用js的点击事件,点击收到反馈