轉載地址:http://elf8848.iteye.com/blog/588025
1、Eclipse中創建新類時自動生成註釋
windows-->preference ---Java-->Code Style-->Code Templates ---code-->new Java files編輯內容如下:
${filecomment}
${package_declaration}
/**
* 說明:
*
* @author 趙磊
* @version 創建時間:${date} ${time}
*/
${typecomment}
${type_declaration}
2、Alt+Shift+J 手動插入類的註釋時,修改如下:window -> preferences -> Java -> Code Style -> Code Temples
點擊 Comments ->Types 點擊 Edit
/**
* 說明:
*
* @author 趙磊
* @version 創建時間:${date} ${time}
* ${tags}
*/
3、Eclipse3.4新JSP文件默認是UTF-8編碼在我以前文章的中有說明,這裏再說一次
把jsp頁面的默認編碼方式改爲utf-8 :
位置:Web->JSP Files,Encoding改爲ISO 10646/Unicode(UTF-8)
4、MyEclipse8.5新JSP文件默認是UTF-8編碼(簡單)
window->preferences->MyEclipse->Files and Editors->JSP
-----------------------------------------------------
5、MyEclipse8.5新JSP文件默認是GBK編碼(不是GB18030),有點複雜
按前面的方法設置是不行的,只有GB18030,沒有GBK。
window->preferences->General->Content Types 右側選Text->jsp 設置的編碼好像沒有用。
解決方法:修改模板
window->preferences->MyEclipse->Files and Editors->JSP->JSP Templates
右側有很多模板,只勾選一個,並雙擊修改他:叫 New JSP File(html)
手工寫入GBK字樣
不用擔心改錯了, 是可以還原的,在window->preferences->MyEclipse->Files and Editors->JSP->JSP Templates 右側一個按鈕叫"Revert to Default"
在新建JSP文件時,按Ctrl + N快捷鍵, 選web下的
就可以使用剛纔修改好的模板了。
新建的JSP文件 聲明是GBK編碼了,
<%@ page language="java" contentType="text/html; charset=GBK" pageEncoding="GBK"%>
實際保存的也會自動是GBK編碼。
在新建的jsp文件上 ,右擊,選屬性,看Text file encoding 處, 也是GBK了。