private ApplicationDocument document = null;
//Initialize global variables
public void init() throws ServletException {
ServletContext application = this.getServletContext();
AccessControlFacade facade = new AccessControlFacade();
DictionaryProcessor dictionaryProcessor = facade.getAllDictionariesWrapper();
/**
* 存入字典
* @param dictionaryProcessor 字典处理器
*/
application.setAttribute(Constant.DICTIONARY_OBJECT_NAME,
dictionaryProcessor);
}
}
〔web.xml〕
<servlet>
<servlet-name> startupservlet </小学教师实习报告 servlet-name>
<servlet-class> com.chinacreator.ac.javabean.servlet.StartupServlet </servlet-class>
<load-on-startup> 10 </load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name> startupservlet </servlet-name>
<url-pattern> /startup </url-pattern>
</servlet-mapping>
〔get.jsp〕
/**
* 取出字典
* @return Object 字典处理器
*/
public Object getDictionaryProcessor() {
return application.getAttribute(Constant.DICTIONARY_OBJECT_NAME);
}