jsp中文问题··急!
我用html传参数name给jsp·但jsp接收到的是乱码·我尝试用request.setCharacterEncoding("gb2312");解决问题但还是不行(GBK,UTF-8都用过了)
最后我还是用了老方法测试
<%String name=request.getParameter("name");
out.println(new String(name.getBytes("ISO8859-1"),"GBK"));%>
<%--
终于输出中文了·但我还是不明白··为什么request.setCharacterEncoding("gb2312");解决不了我的问题呢?请大家帮忙解决谢谢了·我搞了一天头都疼死了
HTML code:
<%--jsp接收页面--%>
<%@ page language="java" import="bean.HelloBean;"%>
<%@ page contentType="text/html;charset=gb2312"%>
<%
request.setCharacterEncoding("gb2312");
%>
<%=request.getParameter("name")%>
<%String name=request.getParameter("name");
out.println(new String(name.getBytes("ISO8859-1"),"GBK"));%>
<html>
<head>
<title>HelloBean</title>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
</head>
<body bgcolor="#FFFFFF">
</body>
</html>
HTML code
Code highlighting produced by Actipro CodeHighlighter (freeware)
相关问答:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jas ......
<html><head><title>[@title]</title>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<script language='javascript'>
function diyCheck ......
用户登录系统就可以在右下角弹出自己收到的消息提示框
请问各位大哥这个在前端如何实现比较好,性能优先
我的思路是:1.前端通过ajax技术隔一段时间请求一下后台,查看当前登录人是否有消息,如果有,则显示隐藏的 ......
网页上已经有一个静态的图片,我想根据屏幕坐标在这个图片上确定两个点,然后用一条直线把这两个点连接起来,在JSP里能实现吗?用JS呢?请指点一下吧!!!,给出个小例子不胜感激!!
改文件的事情,还是留给serve ......