<%@ page contentType="text/html; charset=GBK" %>
<html>
<head>
<title>
jsp1
</title>
</head>
<body bgcolor="#ffffff">
<h1>
<%
request.setCharacterEncoding("GBK");
String sta=request.getParameter("trainstation");
%>
<%=sta %>
</h1>
</body>
</html>
者页面显示的是乱码?怎么解决啊?

解决方案 »

  1.   

    <% 
    request.setCharacterEncoding("GBK"); 
    String sta=request.getParameter("trainstation"); 
    %> 
    zhege去了44
      

  2.   

    你的前一页呢?那页的charset是什么??把你所有的charset都改成 GBK
      

  3.   

     所有的页面编码都是GBK 问题已经解决了,看看大家能不能看出来吧!
      

  4.   

    String sta= new String(sta.getBytes("ISO-8859-1"), "GBK");
      

  5.   

    request.setCharacterEncoding("GBK"); 
    去掉?
      

  6.   

    楼上的也对,我在加上一句:
    这句改为:
    <%@ page contentType="text/html;charset=GBK" pageEncoding="GBK"%>
      

  7.   

    加上<meta http-equiv="Content-Type" content="text/html; charset=GBK" />
      

  8.   

    那过一定是用的get方法传的值是吧!
    哈哈!用get方法的话一定要用字符串转码啊
    String sta=request.getParameter("trainstation");  
     Byte[] stmp=sta.getbytes("ISO-8859-1");
    String str=new String (sta,"gbk");(不知有没有写错啊!没工具不习惯啊!)
    用post方法就不要了啊!
      

  9.   

    表单传送的时候没有写method属性性,或者设置为get方法传送,那样的话,它默认是使用ISO-8859-1来传送信息的.
    所以需要再次转换一下编码
      

  10.   

    你那个是用get还是post传进来的啊