?? layoutconfig.java
字號(hào):
package com.struts2.framework.util;
import java.io.IOException;
import java.util.Properties;
/**
* @author Jecky Luo
*
* Layout類用來讀取layout屬性表的內(nèi)容
*
*/
public class LayoutConfig {
private static LayoutConfig config = new LayoutConfig(); //存放LayoutConfig單一實(shí)例
private static Properties layoutProps = new Properties();
/**
* 構(gòu)造方法設(shè)置為private類型,保證Layout類只有一個(gè)實(shí)例被創(chuàng)建
*/
public LayoutConfig() {
//從屬性文件讀取配置信息
try {
layoutProps.load(
LayoutConfig.class.getClassLoader().getResourceAsStream(
"layout.properties"));
} catch (IOException ioe) {
System.out.println("LayoutConfig file load error: " + ioe.getMessage());
}
}
public static LayoutConfig getInstance() {
return config;
}
/**
* 根據(jù)key返回屬性值
*/
public String getProperty (String key) {
return layoutProps.getProperty(key);
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -