继承HttpServlet

重写doGet(HttpServletRequest req,HttpServletResponse resp),doPost()方法

post提交时:

 protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//post方法:告诉servlet如何去处理文字编码,输出
response.setCharacterEncoding("utf-8");
//告诉浏览器如何处理编码
response.setContentType("text/html;charset=tf-8");
}

Get方法

继承extends HttpServletRequestWrapper

重写getParameter()方法

 @Override
public String getParameter(String name) {
String value=request.getParameter(name);
String method=request.getMethod();
if("get".equalsIgnoreCase(method)){
try {
value=new String(value.getBytes("iso-8859-1"),"utf-8");
} catch (Exception e) {
e.printStackTrace();
}
}
return value;
}

最新文章

  1. 简历生成平台项目开发-STEP2问卷调查结果统计分析
  2. Spark JdbcRDD 简单使用
  3. Python中通过cx_Oracle访问数据库遇到的问题总结
  4. 一个有趣的IE内核检测网站
  5. div里面的内容超出自身高度时,显示省略号
  6. Quartz中时间表达式的设置-----corn表达式
  7. Java语言定义的线程状态分析
  8. ThinkAdmin for PHP后台管理系统
  9. lr_场景设计之知识点-集合点、loadgenerator
  10. 『Python CoolBook』Cython_高效数组操作
  11. 岭回归、LASSO与LAR的几何意义
  12. redis 的简单用法
  13. Python2.7-collections
  14. Sprint计划会议内容
  15. CentOS安装SVN客户端
  16. Python - matplotlib 数据可视化
  17. 你在AutoHotKey面前居然敢比调音量 - imsoft.cnblogs
  18. [Asp.net]Calendar+JqueryUi实现日程管理——添加日程
  19. webservice和wcf和web.api简单介绍
  20. Blue Bird

热门文章

  1. gatewayworker中使用tcp协议连接硬件设备获取数据报错解决办法!
  2. 利用存储过程来重命名SQL Server数据库
  3. Android分享到微信时点击分享无反应的问题解决(注意事项)
  4. bat 栈上限
  5. Linux服务-openssh
  6. 2017-2018-2 20155310『网络对抗技术』Exp5:MSF基础应用
  7. C++ 字符串, 数字 相互转化
  8. mfc Radio Buttons
  9. Kubernetes学习之路(二十)之K8S组件运行原理详解总结
  10. Invitation Cards POJ-1511 (spfa)