博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
jsp post/get中接处理
阅读量:7119 次
发布时间:2019-06-28

本文共 591 字,大约阅读时间需要 1 分钟。

jsp post/get中接处理

以参数:username为便

post接收中文比get接收中文要方便多了。

1 <%@ page contentType="text/html;charset=gb2312"%>2 <%3 request.setCharacterEncoding("gb2312");4 String username = (String) request.getParameter("username");5 %>

 

get接收中文(非常麻烦):

1 <%@ page contentType="text/html;charset=gb2312"%> 2 <% 3 String username = request.getParameter("username"); 4 byte[] bytes = username.getBytes("iso-8859-1"); 5 String result = new String(bytes, "gb2312"); 6 out.print(result); 7  8 String s =new String( new String(request.getParameter("username").getBytes("iso-8859-1") , "gb2312") ); 9 out.print(s);10 %>

 

转载地址:http://olnel.baihongyu.com/

你可能感兴趣的文章
Bootstrap学习笔记
查看>>
Linux配置虚拟主机后,只能访问到主页怎么办?
查看>>
HTTP状态码->HTTP Status Code
查看>>
AVL平衡树的插入例程
查看>>
验证控件的使用
查看>>
会计中的冲销和红票
查看>>
开启和关闭HBase的thrift进程
查看>>
swift学习_xcode6搭建
查看>>
MVC
查看>>
(寻找第K小的数&amp;&amp;寻找第K小的数的和)
查看>>
UVa 642 - Word Amalgamation
查看>>
Linux下编译安装qemu和libvirt
查看>>
VS NuGet使用
查看>>
转载:margin外边距合并问题以及解决方式
查看>>
手机摇一摇功能音量大小跟系统音量一致
查看>>
mysql用一个表更新另一个表的方法
查看>>
一键安装 redmine on windows 和发邮件设置
查看>>
Gradle笔记——构建基础
查看>>
空间矢量数据(.shp文件)之JAVA操作
查看>>
Spring 学习 3- AOP
查看>>