1、
通過(guò)get發(fā)放傳遞中文參數(shù)時(shí)會(huì)有亂碼產(chǎn)生。避免此問(wèn)題的方法一種是更改tomcat中設(shè)置。另一種是改get為post
tomcat中應(yīng)該修改配置文件server.xml中的編碼設(shè)置為:utf-8或者GBK
//代碼
<Connector port="8080"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
debug="0" connectionTimeout="20000"
disableUploadTimeout="true" URIEncoding="UTF-8或GBK"/>
2、
解決下載附件時(shí)文件名中文亂碼問(wèn)題 需要在設(shè)置下載文件時(shí)把名字的編碼改為"ISO8859-1"
//代碼
JspFileDownload jfd = new JspFileDownload();
jfd.setResponse(response);
jfd.setDownType(0);
jfd.setDisFileName(URLEncoder.encode(request.getParameter("filename"),"ISO8859_1"));
3、
在一塊<span/>中使鼠標(biāo)移上之后便手指是在span塊中加入
<span style="cursor:hand"></span>
使其變色為
<span style="color:blue"></span>
4、
通過(guò)JS使頁(yè)面跳轉(zhuǎn)其中一個(gè)方式
window.location.href="";
用JS打開一個(gè)新窗口
window.open("地址", "popupwin", "height="+h+", width="+w+
", top="+top+", left="+left+", toolbar=0, menubar=0, scrollbars=1, resizable=0,location=0, status=1");
強(qiáng)制刷新父頁(yè)面并且關(guān)閉本窗口
window.opener.location.href=window.opener.location.href;
window.close();
5、
servlet中的跳轉(zhuǎn)頁(yè)面
request.getRequestDispatcher("地址").forward(request,response);
6、
這是一個(gè)HQL查詢方法
public List<SysInfomation> findByUser(String user, int pageCount, int page) {
// TODO Auto-generated method stub
String hql = "from SysInfomation f where f.style = 1 and (f.fankuiren = '"+ user + "' or f.shoujianren = '" + user +"') order by f.isread";
return super.find(hql, null, pageCount, page);
}
posted on 2008-06-30 21:55
leweslove 閱讀(208)
評(píng)論(0) 編輯 收藏 所屬分類:
Other