为什么我的网页上的中文全变成了��ѯ��??郁闷
怎么把它改成中文啊
怎么把它改成中文啊
解决方案 »
- 高手请进,这里有个简单的问题,但我完全没头绪
- Eclipse 连接数据库 DB的登录名连接错误...
- 抢分题
- gzip,deflate的关系,有人知道吗?
- JSP 与 Spring,hibernate 使用问题,急!!!
- 谁能推荐个免费的Event calendar web控件啊?像outlook里的日历一样的
- 请问用java怎么读取分割.asf文件?
- 超难讨论:关于alexa之类的流量程序的制作
- jspDestroy在什么时候被调用?
- 有关记事本的源代码问题
- 请问:怎么在以showModalDialog方式弹出的页面中实现history.go(-1)
- 100分跪求jsp操纵access数据库的简单问题,回答就有分
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title></head>
<BODY>
<%@ page contentType="text/html;charset=utf-8" %>
<%@ page import="java.sql.*" %>
<%!
public String codeToString(String str)
{//处理中文字符串的函数
String s=str;
try
{
byte tempB[]=s.getBytes("ISO-8859-1");
s=new String(tempB);
return s;
}
catch(Exception e)
{
return s;
}
}
%><%//构造查询SQL语句
int countRecord=0;//记录条数
int countPageRecord=10;//每页记录条数
int countPage=0;//总页数
int dipage=1;// 当前页码数默认为1
String pages=request.getParameter("dipage");
if(pages==null)
{
pages="1";
}
try
{
dipage=Integer.parseInt(pages);
}
catch(Exception e)
{
dipage=1;
} String kk;
// String isselect="seleted";
kk=codeToString(request.getParameter("updata"));
if(kk==null||"".equals(kk))
kk=codeToString(request.getParameter("ctoj_or_jtoc"));
if(kk==null)
{
kk="ctoj";
}
//else{
// kk=codeToString(request.getParameter("ctoj_or_jtoc"));
//}
//[document.myform.ctoj_or_jtoc.selectedIndex].text;
String sqlString=null;//SQL语句
//request.form("select");
// String ctoj_or_jtoc= request.getParameter("ctoj_or_jtoc");
String You_want=codeToString(request.getParameter("You_want"));
if("ctoj".equals(kk)){
if(You_want==null||You_want.trim().length()==0)
sqlString=new String("SELECT * FROM cnjp");
else
sqlString=new String("SELECT * FROM cnjp where CNword = '"+You_want.trim()+"'");
}
if("jtoc".equals(kk))
//else
{
if(You_want==null||You_want.trim().length()==0)
sqlString=new String("SELECT * FROM jpcn");
else
sqlString=new String("SELECT * FROM jpcn where JPword = '"+You_want.trim()+"'");
//sqlString=new String("SELECT * FROM 1 where jtc like '%"+You_want.trim()+"%'");
}
out.print(sqlString);
out.print(kk);
%>
改为
<meta http-equiv="Content-Type" content="text/html; charset=shift_jis" />
out.print("<form action=search.jsp method=post name=myform>");
out.print("<TR><td>查询单词</td>");
out.print("<td colspan=7>");
out.print("<input type=text name=You_want>");
out.print("查询方式<select name=ctoj_or_jtoc>");
是不时用了out.print("查询方式<select name=ctoj_or_jtoc>");<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />就不管用了啊?
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />