2013年8月24日
#
1.裝新版本的jdk
2.裝一個eclipse最基礎版本
3.安裝apache官網的tomcat,我用的是安裝版
4.下載eclipse中的tomcat插件,目前的地址是:http://www.eclipsetotale.com/tomcatPlugin.html
然后將插件內容copy到eclipse的plugins目錄下,重啟eclipse
5.如果沒有出現小貓圖標,則那么選擇'Window>Customize Perspective...>Commands',并在'Available command groups'中勾選'Tomcat'
6.在Preferences中配置Tomcat,主要配置Version和Home
7.嘗試跑一下,如果不行,看看 首選項 中Java里的 已安裝的JRE是否使用的跟Tomcat中配置的一致
如果還不行,再檢查一下Java編譯器中的JDK版本
8.在tomcat中的server.xml中,設置一下URIEncoding
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF-8"/>
第一步:添加二級緩存配置文件ehcache.xml到項目的src目錄
ehcache.xml文件可以在hibernate-release-4.2.4.Final\project\etc目錄下找到
第二步:配置hibernate.cfg.xml文件
1、首先添加二級緩存支持:
<property name="cache.use_second_level_cache">true</property>
2、添加二級緩存服務提供類:
<property name="cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
3、添加需要用到二級緩存的類
<class-cache usage="read-only" class="com.study.bean.Student"/>
第三步:添加commons-logging-1.1.3.jar,不然會報錯下載地址:http://apache.dataguru.cn//commons/logging/binaries/commons-logging-1.1.3-bin.zip
Java代碼

- /**
- * 初始化組件
- */
- private void initComponent() {
- //提示面板
- errorTipPane = new ErrorTipPane();
- // 主面板
- mainPane = new MainPane();
- // 底部登錄按鈕面板
- downPane = new DownPane();
-
- // 登陸頭像及背景
- lblLoginHeadimg = new JLabel(new ImageIcon("image/Login/qqhead.png"));
- lblLoginHeadbkg = new JLabel(new ImageIcon(
- "image/Login/login_head_white.png"));
- // 用戶名文本框
- jtfAccount = new JTextField("100000");
- jtfAccount.setBorder(new LineBorder(Color.GRAY, 1));
- jtfAccount.setFont(new Font("Verdana", Font.PLAIN, 12));
- jtfAccount.setForeground(Color.black);
-
- // 密碼輸入框
- pwdfPassword = new JPasswordField("1234567890 ");
- pwdfPassword = new JPasswordField("123");
- pwdfPassword.requestFocus(true);
- pwdfPassword.setBorder(new LineBorder(Color.GRAY, 1));
- pwdfPassword.setFont(font);
- pwdfPassword.setForeground(Color.black);
- pwdfPassword.setEchoChar('●');
-
- // 自動登陸復選框
- chkAutoLogin = JButtonUtil.getIconCheckBox(
- "image/Login/checkbox_normal.png",
- "image/Login/checkbox_hover.png",
- "image/Login/checkbox_press.png",
- "image/Login/checkbox_selected_hover.png");
- // 記住密碼復選框
- chkRememberPwd = JButtonUtil.getIconCheckBox(
- "image/Login/checkbox_normal.png",
- "image/Login/checkbox_hover.png",
- "image/Login/checkbox_press.png",
- "image/Login/checkbox_selected_hover.png");
- // 自動登陸標簽
- lblAutoLogin = new JLabel("自動登錄");
- lblAutoLogin.setFont(font);
- lblAutoLogin.setForeground(Color.black);
- // 記住密碼標簽
- lblRememberPwd = new JLabel("記住密碼");
- lblRememberPwd.setFont(font);
- lblRememberPwd.setForeground(Color.black);
-
- this.initStatus();
- this.initButton();
- this.initPupupMenu();
-
- jtfAccount.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseClicked(MouseEvent e) {
- if(e.getClickCount()==1||e.getClickCount()==2){
- mainPane.remove(errorTipPane);
- mainPane.add(downPane);
- downPane.setBounds(0, 241, 380, 51);
- mainPane.updateUI();
- mainPane.validate();
- }
- }
- });
-
- pwdfPassword.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseClicked(MouseEvent e) {
- if(e.getClickCount()==1||e.getClickCount()==2){
- mainPane.remove(errorTipPane);
- mainPane.add(downPane);
- downPane.setBounds(0, 241, 380, 51);
- mainPane.updateUI();
- mainPane.validate();
- }
- }
- });
- }
下載地址:http://yuncode.net/code/c_5204f5d84703a42