Controller里面如何获取request对象
2个回答
展开全部
采用Struts框架的情况下:
public class LoginAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
//在此处编写你的程序,可以使用request
return null;
}
}
不采用Struts框架的情况下:
public class LoginServlet extends HttpServlet {
public void service(HttpServletRequest request, HttpServletResponse response) {
//在此处编写你的程序,可以使用request
}
}
public class LoginAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
//在此处编写你的程序,可以使用request
return null;
}
}
不采用Struts框架的情况下:
public class LoginServlet extends HttpServlet {
public void service(HttpServletRequest request, HttpServletResponse response) {
//在此处编写你的程序,可以使用request
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询