可能是缓存问题
文件头上加上:
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
文件头上加上:
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
解决方案 »
- jpa 1对N,N方有多个字段与1方对应
- wsad中的项目如何移植到eclipse中?
- 树??????????????
- 高分求JAVAMAIL连接SMTP服务器的问题,急急急,绝顶高手快来啊!!!!!!!!!!!!!!!
- 关于_blank的问题
- 哪位有网上商城的源代码,请给我一份,谢谢
- eclipse中tomcat work目录问题
- 菜鸟:请问高手select组件在form提交后获得所有项
- 急!!!一个session 的问题???请问高手???
- SOS之jsp页面参数传递/请进
- oracle中rs.getString("number字段")后返回值如何格式化保留两位小数点的问题?
- jsp 引入java文件怎么运行?
这句好像不是万能的。
=============================我的服务器是Jrun3.1。当从数据库(oracle)提取数据时,用它能正常显示。但是用表单从一个jsp传到另一个jsp时,这句就得改成:
<%@ page contentType="text/html;charset=ISO8859_1" %>
才能正常显示。目前我遇到的问题是:既有从jsp传过来的,又有从oracle提取出来的数据,并且都是中文字符串,用上面哪中都不合适。不知道怎么办?
<%@ page contentType="text/html;charset=gb2312" %>
保证oracle里数据能正常显示
再把从form里取来的数据做如下转换
String varName=new String(request.getParameter("varName").getBytes("ISO8859-1"));
out.println(varName);
//個人經驗.歡迎交流
//==================================================================================
1.進行字符的轉換.要寫函數.一般第一個函數TranStrType就可以了.但有時用其他函數多試幾次
<%!
public String TranStrType(String str) throws Exception
{
byte[] _tempByte=str.getBytes("ISO8859-1");
String _tempStr=new String(_tempByte);
return _tempStr;
}public static String ISOtoGBK(String strvalue)
{
try{
if(strvalue==null)
return null;
else
{
strvalue = new String(strvalue.getBytes("ISO8859-1"),"GBK");
return strvalue;
}
}catch(Exception e){
return null;
}
}
public static String ISOtoGB2312(String strvalue)
{
try{
if(strvalue==null)
return null;
else
{
strvalue = new String(strvalue.getBytes("ISO8859-1"),"gb2312");
return strvalue;
}
}catch(Exception e){
return null;
}
}
public static String ISOtoBIG5(String strvalue)
{
try{
if(strvalue==null)
return null;
else
{
strvalue = new String(strvalue.getBytes("ISO8859-1"),"big5");
return strvalue;
}
}catch(Exception e){
return null;
}
}
public static String Gb2312toISO(String strvalue)
{
try{
if(strvalue==null)
return null;
else
{
strvalue = new String(strvalue.getBytes("gb2312"), "ISO8859-1");
return strvalue;
}
}catch(Exception e){
return null;
}
}
public static String GBKtoISO(String strvalue)
{
try{
if(strvalue==null)
return null;
else
{
strvalue = new String(strvalue.getBytes("gbk"), "ISO8859-1");
return strvalue;
}
}catch(Exception e){
return null;
}
}
public static String GIG5toISO(String strvalue)
{
try{
if(strvalue==null)
return null;
else
{
strvalue = new String(strvalue.getBytes("big5"), "ISO8859-1");
return strvalue;
}
}catch(Exception e){
return null;
}
}
%>
2.用Tomcat4.0.
這個版本的Tomcat再直接連接中文名的文件不會出現找不到文件的情況.而4.1則不行4.在JSP文件第一行加
<%@ page contentType="text/html;charset=big5"%>(繁體 )
<%@ page contentType="text/html;charset=gb2312"%>(簡體 )5.在html的head中加入
<meta http-equiv="Content-Type" content="text/html; charset=big5">(繁體 )
<meta http-equiv="Content-Type" content="text/html; charset=gb2313">簡體 )6.如果是在IE中直接顯示Excel,Word,PowerPoint.則在jakarta-tomcat-4.0\conf的web.xml文件中加入
<mime-mapping>
<extension>xls</extension>
<mime-type>application/msxls</mime-type>
</mime-mapping>
<mime-mapping>
<extension>doc</extension>
<mime-type>application/msword</mime-type>
</mime-mapping>
<mime-mapping>
<extension>ppt</extension>
<mime-type>application/vnd.ms-powerpoint</mime-type>
</mime-mapping>//=======================================================================================
文件头上加上:
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);