如题 中文的问题jsp设置了字符集写了一个Filter处理类基本上不出乱码了,数据库显示也正常,新加了搜索功能就出乱码了按照网上的办法 修改tomcat配置文件,<Connector port="8086" 加上设置字符集的搜索时正常了,其它也正常。-----单页面还有一部分flex开发的,其他部分都不正常了,求解?我不想影响其他人的功能Flex做的,在不改配置文件情况下,还有解决办法么
解决方案 »
- 如何用java做登陆界面?
- JSP中图片路径问题
- frame 取值 问题
- 使用dom4j解析和保存xml时,为什么会解析出错,多写一些字符进去?
- 求助:在线等,最后30分。hibernate一对多查询子表的问题
- jsp连接sqlserver问题
- 如何写一个bean来实现抽奖过程?JSP页面可否动态显示抽奖的跳动过程?
- 请jsp高手看一下response.setHeader的问题(问了二天了,没有人会的),急啊
- jsp开发环境究竟用什么好
- jsp页面的<#if >符号是什么意思
- java与oracle交互,用到call 是怎么回事
- extjs4:这个grid的‘查看课程’有时会跑到第一列,刷新下又跑回倒数第二列,是怎么回事?
表达onsubmit时,将中文内容通过encodeURIComponent(中文内容)设置到表单的隐藏域,提交,服务器端接收隐藏域的值。
试一下吧!
action = "${cxt}servlet/PropertyInfoShowAllServlet?command=" + str_search;
method="post";
submit();
}请问用你的转码 改如何封装一下 呢
str_search = "${command_search}" + "&sel_company=" + encodeURI(encodeURI(s1.value)) + "&sel_zone=" + encodeURI(encodeURI( s2.value ))+ "&sel_pjt=" +encodeURI(encodeURI( s6.value ))+;
String sel_company= request.getParameter("sel_company");
if(!"".equals(sel_company)&&sel_company!=null){
try {
sel_company= URLDecoder.decode(sel_company,"UTF-8");
} catch (UnsupportedEncodingException el) {
logger.debug("根据条件"+sel_company+"查询,出现字符编码异常,异常信息为:"+el);
}
}
第二个是在后台接收该参数时的action处理。
最后,补全参数和对应值
<form method="post" name="form1" >
<table border=0 cellpadding="5" cellspacing="1" class="table_huei">
<tr>
<td colspan="30" class="tr_title1"><center>小区基本信息</center></td>
</tr>
<tr class="tr_data4">
<td width="10%" align="center">企业名称</td>
<td width="23%"><input name="sel_company" id="sel_company" type="text" size="22" value="${safv.sel_company}"></td>
<td width="10%" align="center">小区名称</td>
<td width="23%"><input name="sel_zone" type="text" size="22" value="${safv.sel_zone}"></td>
<td width="10%" align="center">开发商</td>
<td width="23%"><input name="sel_kfs" type="text" size="22" value="${safv.sel_kfs}"></td>
</tr>
<tr class="tr_data2" style="text-align:right">
<td colspan="12" nowrap class="rd19" width="60%">
<div align="right">
<input name="btnx" type="button" class="button1" id="btnx" value="查询" onClick="doX(22)">
<input name="btnc" type="button" class="button1" id="btnc" value="重置" onClick="doC()">
</div></td>
</tr>
</table>
<table border=0 cellpadding="5" cellspacing="1" class="table_huei">
<tr class="tr_data3">
<td><input type="checkbox" id="checkAll" class="inputcheckbox" value="" onClick="checkedAll()"></td>
<td >小区名称</td>以上是jsp页面下面是js
var s1 = document.getElementById("sel_company");
var s2 = document.getElementById("sel_zone");
var s3 = document.getElementById("sel_kfs");
if(s1.value.length<=0 && s2.value.length<=0 && s3.value.length<=0) {
str_search = "${command_maint}";
} else { alert();
var s11 = URLDecoder.decode(s1.value, "utf-8");
var s21 = URLDecoder.decode(s2.value, "utf-8");
var s31 = URLDecoder.decode(s3.value, "utf-8"); alert();
str_search = "${command_search}" + "&sel_company=" + s11 + "&sel_zone=" + s21 + "&sel_kfs=" + s31;
}
window.self.location = "${cxt}servlet/PropertyInfoShowAllServlet?command=" + str_search;
第一个alert可移植性,第二个无法执行换成with提交后也不行