📄 layoutconfig.java
字号:
package com.struts2.framework.util;
import java.io.IOException;
import java.util.Properties;
/**
* @author Jecky Luo
*
* Layout类用来读取layout属性表的内容
*
*/
public class LayoutConfig {
private static LayoutConfig config = new LayoutConfig(); //存放LayoutConfig单一实例
private static Properties layoutProps = new Properties();
/**
* 构造方法设置为private类型,保证Layout类只有一个实例被创建
*/
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;
}
/**
* 根据key返回属性值
*/
public String getProperty (String key) {
return layoutProps.getProperty(key);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -