JSP的参数传递的乱码解决
Tue 29 March 2005
JSP的参数传递的乱码解决
作者: 月光 编程开发
本文解决了JSP的URL字符 encoding 问题:
如果通过 get/post 方式从 browser 返回的值中包含汉字信息, servlet 将无法得到正确的值。\ \ 解决方案\ \ https://www.williamlong.info/index.jsp?value=你好\ \ 解决方案是用这种方案:\ \ \<%@ page contentType=\"text/html;charset=gb2312\" %>\ \<html>\ 你好\<%=new String(request.getParameter(\"value\").getBytes(\"8859_1\"),\"gb2312\")%>\ \</html>

::: {#article_dig style="text-align: right"} []{#note92}顶一下 ▲}([]{#sdig92
) 踩一下 ▼}([]{#sdown92
) :::
::: {.previous_content} « 上一篇 在 HTM 中插入文件 :::
::: {.next_content} 下一篇 » 精妙SQL语句 :::
相关文章
Category: 月光博客2005