Java 在会话+;支柱

Java 在会话+;支柱,java,properties,struts-1,Java,Properties,Struts 1,在Struts 1中,我们可以在会话中加载并设置属性文件,这样我们就不需要在方法级别的每个请求中都加载属性文件。谁能帮我一下吗 Properties props = ... // load your properties file request.getSession().setAttribute("mypropertiesfile", props); 但使用会话存储此类内容不是一个好的做法,为什么不直接使用缓存?下面是一个关于如何使用ehcache的示例:

在Struts 1中,我们可以在会话中加载并设置属性文件,这样我们就不需要在方法级别的每个请求中都加载属性文件。谁能帮我一下吗

Properties props = ...
// load your properties file

request.getSession().setAttribute("mypropertiesfile", props);

但使用会话存储此类内容不是一个好的做法,为什么不直接使用缓存?

下面是一个关于如何使用ehcache的示例: