📄 guiutil.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -