@@@@超巨疑难杂症..............

fengyang 2002-07-10 04:20:10
我有一jsp网页很简单,就是输入一个汉字然后提交再将这个汉字显示出来.
原本一切都很正常的.但是当我在文件头用<jsp:include一个文件后网页照常显示,可是就是原本正常的汉字变成了乱码为什么啊?
...全文
43 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
fengyang 2002-07-11
  • 打赏
  • 举报
回复
接着上面的那个文件:
function keyup(n)
{
if (n==27)
{
this.focus();
}
var currID = document.activeElement.id;

if (currID==null || currID=="")
{
switch (n)
{
case 48://0

location = "http://www.tomor.com";
break;
case 49://1

location = "../product/p1.htm";
break;
case 50://2

location = "../info/info.htm";
break;
case 51://3

location = "../vip/LogonVIPUser.jsp";
break;
case 52://4

location = "../down/download.htm";
break;
case 53://5

location = "../server/server.htm";
break;
case 54://6

location = "../touch/touch.htm";
break;
case 55://7

location = "http://www.dreye.com/tw/";
break;
case 56://8

location = "http://www.englishfree.com.tw/";
break;
case 57://9

location = "http://www.tomor.com/star/";
}
}

}
//-->
</script>
<!-- InstanceEndEditable -->
</HEAD>
<BODY onkeyup=keyup(event.keyCode) id="isbody" bgColor=#000000 leftmargin="0" topmargin="0" onLoad="MM_preloadImages('../pic/botton/menu3_f3.gif','../pic/botton/menu3_f2.gif','../pic/botton/menu3_f4.gif','../pic/botton/menu2_f3.gif','../pic/botton/menu2_f2.gif','../pic/botton/menu2_f4.gif')">
<TABLE width=766 border=0 align="center" cellPadding=0 cellSpacing=0><!-- fwtable fwsrc="033.png" fwbase="00000001.gif" fwstyle="Dreamweaver" fwdocid = "742308039" fwnested="0" -->
<TBODY>
<TR>
<TD><IMG height=1 alt="" src="../p1.files/spacer.gif" width=35 border=0></TD>
<TD><IMG height=1 alt="" src="../p1.files/spacer.gif" width=561 border=0></TD>
<TD><IMG height=1 alt="" src="../p1.files/spacer.gif" width=11 border=0></TD>
<TD><IMG height=1 alt="" src="../p1.files/spacer.gif" width=124 border=0></TD>
<TD><IMG height=1 alt="" src="../p1.files/spacer.gif" width=35 border=0></TD>
<TD><IMG height=1 alt="" src="../p1.files/spacer.gif" width=1 border=0></TD></TR>
<TR>
<TD colSpan=5><IMG height=75 alt="" src="../pic/indexpic/00000001_r1_c1.gif"
width=766 border=0 name=n00000001_r1_c1></TD>
<TD><IMG height=75 alt="" src="../p1.files/spacer.gif" width=1
border=0></TD></TR>
<TR>
<TD background="../pic/indexpic/00000001_r2_c1.gif"> </TD>
<TD align="left" valign="top" background="../pic/bg002.gif"><!-- InstanceBeginEditable name="EditRegion1" -->
<table width="561" height="325" border="1" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td width="557" height="19"><img src="../pic/title03.gif" width="557" height="17"></td>
</tr>
<tr>
<td height="68" align="center" valign="top"><table width="100%" height="291" border="0" cellpadding="0" cellspacing="0">
<tr>

<td width="21%" align="left" valign="top" bgcolor="efefef">
<table width="116" border="0" cellspacing="2" cellpadding="3"> <tr>
<%
String msgStr=request.getParameter("msgStr");
//msgStr = new String(msgStr.getBytes("ISO8859_1"));
String hidden=request.getParameter("hidden");


if (hidden.equalsIgnoreCase("logon"))
{
%>
<td width="106" align="center" height="16"><img src="../pic/botton/menu1_f4.gif" width="105" height="21"></td>
<%
}
else
{
%>
<td width="106" align="center" height="16"> <a href="LogonVIPUser.jsp" onMouseOut="MM_nbGroup('out');" onMouseOver="MM_nbGroup('over','menu1','../pic/botton/menu1_f2.gif','../pic/botton/menu1_f4.gif',1);" onClick="MM_nbGroup('down','navbar1','menu1','../pic/botton/menu1_f3.gif',1);" ><img name="menu1" src="../pic/botton/menu1.gif" width="105" height="21" border="0"></a></td>
<%
}
%>
</tr>
<tr>
<%
if (hidden.equalsIgnoreCase("login"))
{
%>
<td align="center" height="2"><img src="../pic/botton/menu2_f4.gif" width="105" height="21"></td>
<%
}
else
{
%>
<td align="center" height="2"> <a href="EnterOTAKey.jsp" onMouseOut="MM_nbGroup('out');" onMouseOver="MM_nbGroup('over','menu2','../pic/botton/menu2_f2.gif','../pic/botton/menu2_f4.gif',1);" onClick="MM_nbGroup('down','navbar1','menu2','../pic/botton/menu2_f3.gif',1);" ><img name="menu2" src="../pic/botton/menu2.gif" width="105" height="21" border="0"></a></td>
<%
}
%>
</tr>
<tr>
<%
if (hidden.equalsIgnoreCase("info"))
{
%>
<td align="center" height="7"><img src="../pic/botton/menu4_f4.gif" width="105" height="21"></td>

<%
}
else
{
%>
<td align="center" height="7"> <a href="UpdVIPUser.jsp" target="_top" onClick="MM_nbGroup('down','navbar1','menu3','../pic/botton/menu3_f3.gif',1);" onMouseOver="MM_nbGroup('over','menu3','../pic/botton/menu3_f2.gif','../pic/botton/menu3_f4.gif',1);" onMouseOut="MM_nbGroup('out');" ><img name="menu3" src="../pic/botton/menu3.gif" width="105" height="21" border="0"></a></td>
<%
}
%>


</table>
</td>
<td width="79%" valign="top"><table width="100%" height="145" border="0" cellpadding="1" cellspacing="0">
<tr>
<td height="21" valign="middle" bgcolor="#FFCC00"><font size="2"><strong><%=msgStr%></strong></font></td>
</tr>
<tr>
<td align="center" valign="middle">
fengyang 2002-07-11
  • 打赏
  • 举报
回复
如果没有加<jsp:include...
或加一个简单的<jsp:include....
是可以显示正常的.
但加了一个复杂的<jsp:include...
则显示乱码.
可以看看我的包含文件.注:我用的是big5码

<%@ page contentType="text/html; charset=big5"%>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>

<HTML>
<TITLE>One Touch Access</TITLE>
<META http-equiv=Content-Type content="text/html; charset=big5">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_nbGroup(event, grpName) { //v6.0
var i,img,nbArr,args=MM_nbGroup.arguments;
if (event == "init" && args.length > 2) {
if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
nbArr[nbArr.length] = img;
for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = args[i+1];
nbArr[nbArr.length] = img;
} }
} else if (event == "over") {
document.MM_nbOver = nbArr = new Array();
for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
nbArr[nbArr.length] = img;
}
} else if (event == "out" ) {
for (i=0; i < document.MM_nbOver.length; i++) {
img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
} else if (event == "down") {
nbArr = document[grpName];
if (nbArr)
for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
document[grpName] = nbArr = new Array();
for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
nbArr[nbArr.length] = img;
} }
}






Tomcat_lee 2002-07-10
  • 打赏
  • 举报
回复
用以下代码 可以显示正常
<%! String na=""; %>
<%na=request.getParameter("nation");
try{
out.print(new String( na.getBytes("ISO8859_1"),"gb2312"));
}catch(Exception e){}
%>
fengyang 2002-07-10
  • 打赏
  • 举报
回复
都加了!沒用!
zhaoweiemail 2002-07-10
  • 打赏
  • 举报
回复
在原页面和include的页面都要加上<%@ page contentType="text/html;charset=gb2312" %>

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧