第一步:
為了保護視力,先對電腦視窗的背景色進行修改:
設定方法:開啟控制台中的"顯示"選擇外觀(appearance)-進階(advanced),然後在項目(items)那欄選視窗(windows),再點顏色(color) -其它顏色(others),然後把Hue(色調)設為85,Sat(飽和度)設為90,Lum(亮度)設為205。然後單擊添加到自訂色彩(Addtocustomcolors),按“確定”...一直確定。 把視窗設成綠色之後,再來把IE的網頁背景也變成養眼的綠色吧:開啟IE,點擊工具(TOOLS),點INTERNET選項(INTERNETOPTIONS),點右下角的協助工具功能(Assessibility),然後勾選不使用網頁中指定的顏色(ignorecolorsspecifiedonwebpages),然後點“確定”退出
第二步:
Eclipse中建立新類時自動產生注釋
windows-->preference-->Java-->Code Style-->Code Templates-->code-->new Java files
編輯它 ,內容如下
[html] view plain copy ${filecomment} ${package_declaration} /** * @Title: ${file_name} * @Package ${package_name} * @Description: ${todo} * @author ${user} * @date ${date} ${time} * @version V1.0.0 */ ${typecomment} ${type_declaration}
第三步:
Alt+Shift+J 手動插入類的注釋時,修改如下:
window -> preferences -> Java -> Code Style -> Code Temples
點擊 Comments ->Types 點擊 Edit
[html] view plain copy /** * @Description: ${todo} * @author ${user} * @date ${date} ${time} */
第四步:
格式化代碼時,一行最多字元數
java-CodeStyle-Formatter,點new,建立一個自己的設定檔, 點edit,在新開啟的視窗中選Line Wrapping選項卡, 修改Maximum line width 為140,儲存。
第五步:
設定控制台顯示列印的最大行數,以免錯誤資訊被衝掉:
window -> preferences ->Run/Debug-->Console
把Console buffer size(characters) 設定成:999999
第六步:修改工作空間預設項目編碼(我這裡修改成UTF-8)
window -> preferences ->General-->Workspace
把Text file encoding的編碼選擇UTF-8
第7步:修改HTML、JSP等,建立時的預設編碼設定
window -> preferences ->Web-->HTML Files
或者
window -> preferences ->Web-->JSP Files
第八步:
設定jsp模板:
eclipse -- >perferences - >web ->jsp - jsp files -Editor ->templates 在這裡可以設定模板。
將 JSP WITH HTMl 裡面內容替換為如下:
<%@ page language="Java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>標題</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
</head>
<body>
${cursor}
</body>
</html>
替換之後那麼以後建立的jsp一般預設的都是這個格式了。
10 配置本機伺服器。(我用的tomcat)將tomcat路徑添加到伺服器中。
11 設定高亮顯示: