首页 > 其他 > 详细

Servlet学习笔记

时间:2016-03-30 22:18:45      阅读:206      评论:0      收藏:0      [点我收藏+]

Servlet开发步骤


  1. 继承HttpServlet
  2. 重写doGet和doPost方法
  3. 在web.xml注册servlet(servlet3.0中不需要注册,,选择新建servlet时,系统自动直接使用@webservlet注解)
    技术分享

重写doGet()与doPost()注意事项

  • super.doGet(req, resp);需注释掉(这是调用了父类的方法)
  • 使用PrintWriter时,需用resp.setContentType("text/html;charset=utf-8");//设置显示方式及编码

Servlet与JSP九大内置对象

JSP对象 Servlet中怎样获得
out resp.getWriter
request req参数
response resp参数
session req.getSession()函数
application getServletContext()函数
exception Throwable
page this
pageContext pageContext
Config getServletConfig()函数

Java后台处理form表单提交的复选框数据(字符串数组)

String[] favorites;
favorites = request.getParameterValues("favorite");





Servlet学习笔记

原文:http://www.cnblogs.com/Val1ant/p/5338900.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!