<HTML><HEAD><TITLE>宁波公交线路查询</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<%@ page contentType="text/html; charset=UTF-8" language="java" import="java.sql.*,java.util.*,com.line.*" errorPage="" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<% request.setCharacterEncoding("UTF-8");%>
<jsp:useBean id="lineFun" scope="page" class="com.line.LineFun"></jsp:useBean>
<%String line_name="";
String stop_name="";
List lines=null;
//out.print(new String(request.getParameter("stop_name")).length());
if(request.getParameter("stop_name")!=null&&request.getParameter("stop_name")!=""){
stop_name=request.getParameter("stop_name").toString().trim();
stop_name=new String(stop_name.getBytes("8859_1"),"utf-8");
out.print(stop_name);
}
%>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<%@ page contentType="text/html; charset=UTF-8" language="java" import="java.sql.*,java.util.*,com.line.*" errorPage="" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<% request.setCharacterEncoding("UTF-8");%>
<jsp:useBean id="lineFun" scope="page" class="com.line.LineFun"></jsp:useBean>
<%String line_name="";
String stop_name="";
List lines=null;
//out.print(new String(request.getParameter("stop_name")).length());
if(request.getParameter("stop_name")!=null&&request.getParameter("stop_name")!=""){
stop_name=request.getParameter("stop_name").toString().trim();
stop_name=new String(stop_name.getBytes("8859_1"),"utf-8");
out.print(stop_name);
}
%>
上面一个获取的结果是:西草马路
http://localhost:8080/gjcx/serve_1.jsp?stop_name=西草马
上面一个获取的结果是:西草�
String temp=rs.getString("Station");
try{
temp=URLEncoder.encode(temp,"UTF-8");
}
catch(UnsupportedEncodingException e)
{ }
lineinfo += "<a href=\"serve_1.jsp?stop_name="+temp+"\">"+rs.getString("Station")+"</a>、";
}
<META http-equiv=Content-Type content="text/html; charset=utf-8">
该为
<META http-equiv=Content-Type content="text/html; charset=gb2312">