guiutil.java
来自「一个使用struts+hibernate+spring开发的完的网站源代码。」· Java 代码 · 共 37 行
JAVA
37 行
package org.apache.myfaces.examples.util;import javax.faces.context.FacesContext;import java.util.ResourceBundle;import java.util.MissingResourceException;import java.text.MessageFormat;/** * @author Thomas Spiegl (latest modification by $Author: matzew $) * @version $Revision: 1.1 $ $Date: 2005/03/24 16:47:11 $ */public class GuiUtil{ private static String BUNDLE_NAME = "org.apache.myfaces.examples.resource.example_messages"; public static String getMessageResource(String key, Object[] arguments) { FacesContext context = FacesContext.getCurrentInstance(); String resourceString; try { ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_NAME, context.getViewRoot().getLocale()); resourceString = bundle.getString(key); } catch (MissingResourceException e) { return key; } if (arguments == null) return resourceString; MessageFormat format = new MessageFormat(resourceString, context.getViewRoot().getLocale()); return format.format(arguments); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?