📄 labellocatorhook.java
字号:
/* LabelLocatorHook.java{{IS_NOTE Purpose: Description: History: Thu Apr 7 16:49:15 2005, Created by tomyeh}}IS_NOTECopyright (C) 2005 Potix Corporation. All Rights Reserved.{{IS_RIGHT This program is distributed under GPL Version 2.0 in the hope that it will be useful, but WITHOUT ANY WARRANTY.}}IS_RIGHT*/package org.zkoss.web.init;import javax.servlet.ServletContextListener;import javax.servlet.ServletContextEvent;import javax.servlet.ServletContext;//import org.zkoss.util.logging.Log;import org.zkoss.util.resource.Labels;import org.zkoss.web.util.resource.ServletLabelLocator;import org.zkoss.web.util.resource.ServletLabelResovler;/** * Used to hook a label locator to locate resources from the servlet context. * * <p>Note: you don't need to specify this in web.xml if you use ZK * because org.zkoss.zk.ui.DHtmlLayoutServlet will register the label locator * automatically. * * <p>If you don't use ZK, you could declare<pre><code><listener> <description>Load i3-label.properties from this Web app</description> <display-name>Locating i3-label.properties</display-name> <listener-class>org.zkoss.web.init.LabelLocatorHook</listener-class></listener></code></pre> * * @author tomyeh */public class LabelLocatorHook implements ServletContextListener { //private static final Log log = Log.lookup(LabelLocatorHook.class); public void contextDestroyed(ServletContextEvent sce) { } public void contextInitialized(ServletContextEvent sce) { final ServletContext ctx = sce.getServletContext(); //if (log.debugable()) log.debug("Hook label locator for "+ctx); Labels.register(new ServletLabelLocator(ctx)); Labels.setVariableResolver(new ServletLabelResovler()); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -