断点

每天进步一点点!
posts - 174, comments - 56, trackbacks - 0, articles - 21

jsp传参出现的乱码问题

Posted on 2010-07-24 16:57 断点 阅读(337) 评论(0)  编辑  收藏 所属分类: JSP

--情况1:多个参数的传递,由于多个文件编码不一致,可能出现乱码。

window.open(base+"/policy/universal/pop/flat_vhl_inf_query.jsp?

cLcnNo="+objPlateNo.value+"&cEngNo="+objEngNo.value+"&cVhlFrm="+objFrmNo.value+"&cPlateTy

p="+objPlateTyp+"&cProdNo="+objCProdNo+"&cDptCde="+objCDptCde+"&cNewMrk="+objNewMrk.value

+"&cEcdemicMrk="+objEcdemicMrk.value,"","scrollbars=yes,left=100,top=150,Toolbar=no,Locat

ion=no,Direction=no,Resizeable=no,Width="+800+" ,Height="+400);


--相应的jsp获得参数
<% 
 String CProdNo = request.getParameter("prodNo");
 String CDptCde = request.getParameter("dptCde");

 String CPlateNo = request.getParameter("plateNo");

 String CFrmNo = request.getParameter("frmNo");
 
 if("".equals(CPlateNo)&&"".equals(CFrmNo)){
  return;
 }
     
 String dwName = "policy.pub.flat_vhl_inf_DW";
%>


--情况2:解决乱码的问题。
function tool_uploadFile(clmNo,billType,maxFileNum,fileType,singleLimit,totalLimit) {//解决乱码的问题,增加变量paramObj。ztf 10.06.01
 var paramObj = {
  "clmNo" : clmNo,
  "billType" : billType,
  "maxFileNum" : maxFileNum,
  "fileType" : fileType,
  "singleLimit" : singleLimit,
  "totalLimit" : totalLimit
 };
 var r = window.showModalDialog(global.WEB_APP_NAME+"/core/jsp/common/uploadFile.jsp",paramObj,"dialogHeight:610px;dialogWidth:530px;center:1;help: 0; status: 0;");

 return r;
}

--在相应的jsp页面通过js获得参数:
<html>
  <head>
    <title>文件上传</title>
  </head>
  <script type="text/javascript" src="<%=webApp%>/core/js/core/Tool.js"></script>
  <body bgcolor="#85b7ec">
 
  <script>
 var paramObj = window.dialogArguments;
 var clmNo = paramObj.clmNo;
 var billType = paramObj.billType;
 var maxFileNum = paramObj.maxFileNum;
 var fileType = paramObj.fileType;
 var singleLimit = paramObj.singleLimit;
 var totalLimit = paramObj.totalLimit;
 tool.loadApplet('<%=agentIp%>','<%=agentPort%>','<%=orgId%
>',clmNo,billType,maxFileNum,fileType,singleLimit,totalLimit);
  </script>

</body>
</html>


vReturnValue = window.showModalDialog(sURL [, vArguments] [, sFeatures])


只有注册用户登录后才能发表评论。


网站导航: