提交文件:
<%@ page contentType="text/html; charset=UTF-8"
language="java"
import="java.sql.*,java.sql.*,java.io.*,javax.naming.*,javax.sql.*,java.util.Date,java.text.*"
errorPage=""
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<form name="form1" method="post" action="" ENCTYPE="multipart/form-data">
<input type="hidden" name="ID" value="<%=ID%>">
<input type="FILE" name="R_file" size="30" style="width:350px">
</form>
处理文件:
<%@ page contentType="text/html; charset=UTF-8"
language="java"
import="java.sql.*,java.sql.*,java.io.*,javax.naming.*,javax.sql.*,java.util.Date,java.text.*,com.jspsmart.upload.*"
errorPage=""
%>
<%
request.setCharacterEncoding("UTF-8");
com.jspsmart.upload.SmartUpload mySmartUpload=new com.jspsmart.upload.SmartUpload();
mySmartUpload.initialize(pageContext);
mySmartUpload.upload();
String ID=(String)mySmartUpload.getRequest().getParameter("ID");
String NAME=(String)mySmartUpload.getRequest().getParameter("NAME");
out.print(NAME);
%>
String NAME=(String)mySmartUpload.getRequest().getParameter("NAME")接收的中文全是乱码。
请问怎样才能取中文?
谢谢!
<%@ page contentType="text/html; charset=UTF-8"
language="java"
import="java.sql.*,java.sql.*,java.io.*,javax.naming.*,javax.sql.*,java.util.Date,java.text.*"
errorPage=""
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<form name="form1" method="post" action="" ENCTYPE="multipart/form-data">
<input type="hidden" name="ID" value="<%=ID%>">
<input type="FILE" name="R_file" size="30" style="width:350px">
</form>
处理文件:
<%@ page contentType="text/html; charset=UTF-8"
language="java"
import="java.sql.*,java.sql.*,java.io.*,javax.naming.*,javax.sql.*,java.util.Date,java.text.*,com.jspsmart.upload.*"
errorPage=""
%>
<%
request.setCharacterEncoding("UTF-8");
com.jspsmart.upload.SmartUpload mySmartUpload=new com.jspsmart.upload.SmartUpload();
mySmartUpload.initialize(pageContext);
mySmartUpload.upload();
String ID=(String)mySmartUpload.getRequest().getParameter("ID");
String NAME=(String)mySmartUpload.getRequest().getParameter("NAME");
out.print(NAME);
%>
String NAME=(String)mySmartUpload.getRequest().getParameter("NAME")接收的中文全是乱码。
请问怎样才能取中文?
谢谢!
解决方案 »
- strust2获取上传 文件路径、类型问题
- JS弹出窗口
- TOMCAT6.0配置MYSQL数据源的问题,哪位大哥能给小弟详细讲讲啊?
- 请教,关于CheckBox的问题~~~
- 大家推荐一个好用的开源连接池憋
- 急!!急!急1急!急!急!急!急!急!急!急!急!急急急!请问 那位大侠有关于pagetaglib分页技术的详细中文介绍,有具体实例最好(在
- 关于war包中文件访问路径的问题,急
- 关于jsp判断数字
- 请教,JSP中文乱码问题!急...
- 我用jsp调用db2数据库的时候出现如下问题,请各位大虾给与指教,在线等候,多谢!
- 用hibernate取出数据库nchar类型的整个值
- 周日历,请各位大侠们帮忙了~~
public void forDownload(HttpServletResponse response, String filename)
throws ExcelHelperException {
try {
// 设置输出的格式
response.reset();
response.setContentType("application/x-msdownload");
// 汉字转码
String dfname = URLEncoder.encode(filename, "UTF8");
response.addHeader("Content-Disposition", "attachment; filename="
+ dfname);
ServletOutputStream out = response.getOutputStream();
// 循环取出流中的数据
int len;
// 读到流中
FileInputStream in = new FileInputStream(path + File.separator
+ fileName);
byte[] l_data = new byte[1024];
while ((len = in.read(l_data)) > 0) {
out.write(l_data, 0, len);
}
out.close();
} catch (Exception e) {
e.printStackTrace();
throw new ExcelHelperException("输出下载流时出错");
} };
new String(mySmartUpload.getRequest().getParameter("NAME").getBytes("GBK"),"ISO-8859-1")
都不行,转了还是乱码。
to:1楼
能把你的代码改成JSP能用的吗?谢谢