📄 messageresources.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Thu Mar 09 15:31:25 GMT 2006 -->
<TITLE>
Apache Struts API Documentation: Class MessageResources
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/MessageResources.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../org/apache/struts/util/LabelValueBean.html"><B>PREV CLASS</B></A>
<A HREF="../../../../org/apache/struts/util/MessageResourcesFactory.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="MessageResources.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.apache.struts.util</FONT>
<BR>
Class MessageResources</H2>
<PRE>
java.lang.Object
|
+--<B>org.apache.struts.util.MessageResources</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD>java.io.Serializable</DD>
</DL>
<DL>
<DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../../org/apache/struts/util/PropertyMessageResources.html">PropertyMessageResources</A></DD>
</DL>
<HR>
<DL>
<DT>public abstract class <B>MessageResources</B><DT>extends java.lang.Object<DT>implements java.io.Serializable</DL>
<P>
General purpose abstract class that describes an API for retrieving Locale-sensitive messages from underlying resource locations of an unspecified design, and optionally utilizing the <code>MessageFormat</code> class to produce internationalized messages with parametric replacement. <p> Calls to <code>getMessage()</code> variants without a <code>Locale</code> argument are presumed to be requesting a message string in the default <code>Locale</code> for this JVM. <p> Calls to <code>getMessage()</code> with an unknown key, or an unknown <code>Locale</code> will return <code>null</code> if the <code>returnNull</code> property is set to <code>true</code>. Otherwise, a suitable error message will be returned instead. <p> <strong>IMPLEMENTATION NOTE</strong> - Classes that extend this class must be Serializable so that instances may be used in distributable application server environments.
<P>
<DL>
<DT><B>Version: </B><DD>$Rev: 264684 $ $Date: 2005-08-30 04:08:01 +0100 (Tue, 30 Aug 2005) $</DD>
<DT><B>See Also: </B><DD><A HREF="../../../../serialized-form.html#org.apache.struts.util.MessageResources">Serialized Form</A></DL>
<HR>
<P>
<!-- ======== INNER CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Field Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/util/MessageResources.html#config">config</A></B></CODE>
<BR>
The configuration parameter used to initialize this MessageResources.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected static <A HREF="../../../../org/apache/struts/util/MessageResourcesFactory.html">MessageResourcesFactory</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/util/MessageResources.html#defaultFactory">defaultFactory</A></B></CODE>
<BR>
The default MessageResourcesFactory used to create MessageResources instances.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected java.util.Locale</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/util/MessageResources.html#defaultLocale">defaultLocale</A></B></CODE>
<BR>
The default Locale for our environment.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/util/MessageResources.html#escape">escape</A></B></CODE>
<BR>
Indicates whether 'escape processing' should be performed on the error message string.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected <A HREF="../../../../org/apache/struts/util/MessageResourcesFactory.html">MessageResourcesFactory</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/util/MessageResources.html#factory">factory</A></B></CODE>
<BR>
The <code>MessageResourcesFactory</code> that created this instance.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected java.util.HashMap</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/util/MessageResources.html#formats">formats</A></B></CODE>
<BR>
The set of previously created MessageFormat objects, keyed by the key computed in <code>messageKey()</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected static org.apache.commons.logging.Log</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/util/MessageResources.html#log">log</A></B></CODE>
<BR>
Commons Logging instance.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/util/MessageResources.html#returnNull">returnNull</A></B></CODE>
<BR>
Indicate is a <code>null</code> is returned instead of an error message string when an unknown Locale or key is requested.</TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../org/apache/struts/util/MessageResources.html#MessageResources(org.apache.struts.util.MessageResourcesFactory, java.lang.String)">MessageResources</A></B>(<A HREF="../../../../org/apache/struts/util/MessageResourcesFactory.html">MessageResourcesFactory</A> factory, java.lang.String config)</CODE>
<BR>
Construct a new MessageResources according to the specified parameters.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../org/apache/struts/util/MessageResources.html#MessageResources(org.apache.struts.util.MessageResourcesFactory, java.lang.String, boolean)">MessageResources</A></B>(<A HREF="../../../../org/apache/struts/util/MessageResourcesFactory.html">MessageResourcesFactory</A> factory, java.lang.String config, boolean returnNull)</CODE>
<BR>
Construct a new MessageResources according to the specified parameters.</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/util/MessageResources.html#escape(java.lang.String)">escape</A></B>(java.lang.String string)</CODE>
<BR>
Escape any single quote characters that are included in the specified message string.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/util/MessageResources.html#getConfig()">getConfig</A></B>()</CODE>
<BR>
The configuration parameter used to initialize this MessageResources.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../org/apache/struts/util/MessageResourcesFactory.html">MessageResourcesFactory</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/util/MessageResources.html#getFactory()">getFactory</A></B>()</CODE>
<BR>
The <code>MessageResourcesFactory</code> that created this instance.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>abstract java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/util/MessageResources.html#getMessage(java.util.Locale, java.lang.String)">getMessage</A></B>(java.util.Locale locale, java.lang.String key)</CODE>
<BR>
Returns a text message for the specified key, for the default Locale.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/util/MessageResources.html#getMessage(java.util.Locale, java.lang.String, java.lang.Object)">getMessage</A></B>(java.util.Locale locale, java.lang.String key, java.lang.Object arg0)</CODE>
<BR>
Returns a text message after parametric replacement of the specified parameter placeholders.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/util/MessageResources.html#getMessage(java.util.Locale, java.lang.String, java.lang.Object[])">getMessage</A></B>(java.util.Locale locale, java.lang.String key, java.lang.Object[] args)</CODE>
<BR>
Returns a text message after parametric replacement of the specified parameter placeholders.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/struts/util/MessageResources.html#getMessage(java.util.Locale, java.lang.String, java.lang.Object, java.lang.Object)">getMessage</A></B>(java.util.Locale locale, java.lang.String key, java.lang.Object arg0, java.lang.Object arg1)</CODE>
<BR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -