客户端:
<s:property value="%{getText('test')}"/>
服务端:
public class GetConfig extends Properties {
//定义ProReader类静态对象instance
private static GetConfig instance;
/**
* 类构造函数,读取属性配置文件
*/
private GetConfig() {
// 读取数据库配置文件
InputStream ins = this.getClass().getResourceAsStream("/test.properties");
try {
// 将文件中的数据存储到内存中
this.load(ins);
} catch (Exception e) {
System.out.println("读取数据库配置文件出错!");
}
}
/**
* 获取instance值
* @return instance
*/
public static GetConfig getInstance() {
if (instance != null) {
return instance;
} else {
makeInstance();
return instance;
}
}
/**
* 创建instance值
*/
private static synchronized void makeInstance() {
if (instance == null)
instance = new GetConfig();
}
}
<s:property value="%{getText('test')}"/>
服务端:
public class GetConfig extends Properties {
//定义ProReader类静态对象instance
private static GetConfig instance;
/**
* 类构造函数,读取属性配置文件
*/
private GetConfig() {
// 读取数据库配置文件
InputStream ins = this.getClass().getResourceAsStream("/test.properties");
try {
// 将文件中的数据存储到内存中
this.load(ins);
} catch (Exception e) {
System.out.println("读取数据库配置文件出错!");
}
}
/**
* 获取instance值
* @return instance
*/
public static GetConfig getInstance() {
if (instance != null) {
return instance;
} else {
makeInstance();
return instance;
}
}
/**
* 创建instance值
*/
private static synchronized void makeInstance() {
if (instance == null)
instance = new GetConfig();
}
}