来源:未知 作者:中博IT教育 发布时间:2012-03-04 10:44:01
<html> <head> <title>enctype属性测试</title> </head> <body> <form action="pro.jsp" method="post" enctype="application/x-www-form-urlencoded"> 上传文件: <input type="file" name="file" /><br /> 请求参数: <input type="text" name="info" /><br /> <input type="submit" value="提交" /> </form> </body> </html> |
<%@ page contentType="text/html; charset=GBK"%> <%@ page import="java.io.*"%> <% //获取HTTP请求的输入流 InputStream is=request.getInputStream(); //创建缓冲读入流 BufferedReader br=new BufferedReader(new InputStreamReader(is)); //读取HTTP请求内容 String buffer=br.readLine(); while(buffer!=null){ out.println(buffer); buffer=br.readLine(); } %> |
public class TestURLEncoder { public static void main(String[] args)throws Exception { String encodeStr="%D0%EC%D6%DD"; System.out.println(URLDecoder.decode(encodeStr,"GBK")); String rawStr="北大青鸟"; System.out.println(URLEncoder.encode(rawStr,"GBK")); } } |
相关阅读:
上一篇:没有了