感谢net_lover解决框架关闭问题.

lijunjiejava 2004-10-19 11:17:18
rt
...全文
67 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
lijunjiejava 2004-11-22
  • 打赏
  • 举报
回复
用poi的HSSF组件将汉字写入EXCEL中出现乱码的问题我已经解决了。
写了一个方法,调用一下就可以了。方法的源代码如下:
public static String getUnicode(String toEncoded,String encoding)
{
String retString="";
if(toEncoded.equals("")||toEncoded.trim().equals(""))
{
return toEncoded;
}
try
{
byte[] b=toEncoded.getBytes(encoding);
sun.io.ByteToCharConverter convertor=sun.io.ByteToCharConverter.getConverter(encoding);
char [] c=convertor.convertAll(b);
for(int i=0;i<c.length;i++)
{
retString+=String.valueOf(c[i]);
}
}catch(java.io.UnsupportedEncodingException usee)
{
System.out.println("不支持"+encoding+"编码方式");
usee.printStackTrace();
}catch(sun.io.MalformedInputException mfie)
{
System.out.println("输入参数无效!!!");
mfie.printStackTrace();
}
return retString;
}
使用方法为:
cell=row.createCell((short)2);
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
String temp="中央人民广播天台3台";
temp=getUnicode(temp,"gb2312");
cell.setCellvalue(temp);

lijunjiejava 2004-11-22
  • 打赏
  • 举报
回复
server.xml找到
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">

紧接着下面添加
<Context path="" docBase="E:\myJSP\" debug="0" reloadable="true" />

修改你想要的路径就行了 !
孟子E章 2004-10-19
  • 打赏
  • 举报
回复
不用客气,以后有问题尽管贴

81,091

社区成员

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

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