解决办法
String str = new String(request.getParameter("title").getBytes(),"iso-8859-1");
这样str就不是乱码了
String str = new String(request.getParameter("title").getBytes(),"iso-8859-1");
这样str就不是乱码了
解决方案 »
- flex绘制拓扑图的问题
- struts2 标签 <s:select /> 使用问题,高手进!
- java.nio.BufferOverflowException
- j2ee入门的问题
- eclipse的安装问题.高分请教
- spring+hibernate+struts操作大字段,功能已实现,但抛出异常,如下:
- 两张关联表的数据查询
- Spring,Struts,Hibernate,ajax技术交流。
- 急租高级Java开发工程师
- 用struts2+ajax表单提交时,有谁遇到过这个异常?异步提交不需要result
- 我现在正有用一台hp-nux下,装有tomcat+oracle开发jsp环境,可是JAVA进程老是占用很大,而且TOMCAT总是死掉,不知是为什么?
- 请问如何将JTable像JButton一样置灰
String t = new String(request.getParameter("title").getBytes("iso-8859-1"),"utf-8");
然后你再用javax.swing.JOptionPane.showMessageDialog(null,t)输出看看
解决此问题的方法就是
String str = new String(request.getParameter("title").getBytes("iso-8859-1"),"utf-8");
然而我在tomcat4.1下面却可以运行!为什么在tomcat5.0下就不行了呢?
<%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ page contentType="text/html; charset=GBK" %>
我在后台Action中进行处理时
用request.getParameter("title")显示的是乱码?是不是tomcat5.0对中文支持不是很好呀!
为什么用tomcat4.0就支持呢?是不是要下载什么东东?
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ page contentType="text/html; charset=GBK" %>在后台 String str = new String(request.getParameter("title").getBytes("iso-8859-1"),"GBK");
转换
port="8080" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
debug="0" connectionTimeout="20000"
disableUploadTimeout="true" URIEncoding="GBK"/>和
<Connector port="8009"
enableLookups="false" redirectPort="8443" debug="0"
protocol="AJP/1.3" URIEncoding="GBK"/>
中添加
URIEncoding="GBK"