
##ļ freemarkerstatic.properties
_Validator=com.longyou.util.Validator
_Functions=com.longyou.util.Functions
_EscapeUtils=com.longyou.util.EscapeUtils


//Javaʵ
Configuration config = new Configuration();
BeansWrapper wrapper = BeansWrapper.BEANS_WRAPPER;
wrapper.setExposureLevel(BeansWrapper.EXPOSE_ALL);
InputStream in = null;
try{
      in = ClassLoaderUtils.getResourceAsStream("/freemarkerstatic.properties", FreemarkerUtils.class);
      if(in != null){
          Properties props = new Properties();
          props.load(in);
          Enumeration en = props.keys();
          String name, value;
          TemplateHashModel staticModels = wrapper.getStaticModels();
          while(en.hasMoreElements()){
        name = (String)en.nextElement();
        value = props.getProperty(name);
        TemplateHashModel tempStatics = (TemplateHashModel) staticModels.get(value);
        config.setSharedVariable(name, tempStatics);
          }
     }
}catch(Exception ex){
       log.error("Error while loading freemarker settings from /freemarkerstatic.properties", ex);
}finally{
      if(in != null){
        try{
        in.close();
        }catch(Exception ex){               
                ex.printStackTrace();
        }
        in = null;
     }
}
config.setObjectWrapper(wrapper);

//ô
${_Functions.toUpperCase("Hello")}<br>
${_EscapeUtils.escape("Java̳")}

//
HELLO
Java%u89C6%u7EBF%u8BBA%u575B 