request的细节--学习笔记
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了request的细节--学习笔记相关的知识,希望对你有一定的参考价值。
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class Demo91 extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
//response.setContentType("text/html;charset=UTF-8");
//PrintWriter pw = response.getWriter();
//pw.write("Demo91");
//pw.flush();
//pw.close();
//转发
//request.getRequestDispatcher("/Demo92").forward(request,response);
//重定向
response.sendRedirect("/day06/success.html");
}
}
转发java
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class Demo92 extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
//输出
response.getWriter().write("Demo92");
}
}
以上是关于request的细节--学习笔记的主要内容,如果未能解决你的问题,请参考以下文章
[原创]java WEB学习笔记61:Struts2学习之路--通用标签 property,uri,param,set,push,if-else,itertor,sort,date,a标签等(代码片段