1. 程式人生 > >JSP 處理 POST和GET請求

JSP 處理 POST和GET請求

例如 enc utf get post character 頁面 odi .get

JSP頁面接受post請求,如果請求的參數值裏包含非西歐字符,首先需要調用 request.setCharacterEncoding("UTF-8"); 如果是GET請求,不能這樣做,可先獲取字節流,再將其轉化為String

例如: byte[] raw=rawName.getBytes("ISO-8859-1"); String name=new String(rawBytes,"UTF-8");

JSP 處理 POST和GET請求