解决Post和Get乱码问题
来源:互联网 发布:纽约大学gpa算法 编辑:程序博客网 时间:2024/04/30 22:25
package com.clg.demo;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class DemoServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
test1(request, response);
}
//post提交方式
private void test1(HttpServletRequest request, HttpServletResponse response) {
request.setCharacterEncoding("UTF-8");
String username = request.getParameter("username");
System.out.println(username);
}
//get提交方式
private void test2(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException {
String username = request.getParameter("username");
username=new String(username.getBytes("iso8859-1"),"UTF-8");
System.out.println(username);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {}
}
- 解决Post和Get乱码问题
- post乱码、get乱码问题如何解决?
- POST请求和GET请求分别解决乱码问题
- 解决Get和Post请求中中文乱码问题
- 解决Get和post请求中中文乱码问题
- web工程解决post和get乱码问题
- springmvc解决乱码问题(get和post)
- 解决Get和Post请求中文乱码的问题
- GET&POST方式解决中文乱码问题
- 解决post、get提交中文乱码问题
- 解决 post和get请求乱码
- 解决post和get乱码过滤器
- post和get请求乱码解决
- 解决get和post请求 全部乱码
- GET POST乱码解决
- get和post方式提交乱码问题
- get 和 post 方式提交乱码问题
- GET和POST乱码问题剖析
- 影响一生的职业建议
- 短信消息通知服务-spring定时计划任务quartz(二)
- eclipse3.6下整合Axis2开发WebService实例
- sqlite3 多线程 并发
- MySQL与存储过程
- 解决Post和Get乱码问题
- lucene优化
- 获取android手机信息
- MySQL使用
- JavaScript树形目录 收集整理
- 缓冲加载图片的 jQuery 插件 lazyload.js 使用方法详解
- matplotlib画图时的中文设置
- Android内存泄漏简介
- MySQL规范