public static String getResource(
ServletContext pContext,
String pBundle,
String pKey)
throws Exception
{
MessageResources lResources = (MessageResources)pContext.getAttribute(pBundle);
if (lResources == null)
{
mLogger.warn("cannot find '" + pBundle + "' in ServletContext");
return "";
}
if (lResources.isPresent(pKey)) //
{
return lResources.getMessage(pKey);
}
else
{
mLogger.warn("cannot find key '" + pKey + "' in bundle '" + pBundle + "'");
return "";
}
}
HTH, Adam
On 08/29/2003 03:51 AM Yakov Belov wrote:
Thanks Adam, your comments make sense if I was using Struts1.1, but for reasons out of my control I am using Struts1.0 and the struts-config_1_0.dtd doesnt define <nessage-resources> tag ... so, I can't use it.
But I can use the <html:errors property="<property>" bundle="<bundle>"> tag, however I can not define a new bundle with some key because of absense of the <message-resources> in the dtd. Is there another way to define a bundle other than a default one?
I feel like a total newbie in this issue.
Thanks in advance.
Yakov Belov
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- struts 1.1 + tomcat 4.1.27 + java 1.4.2 Linux 2.4.20 RH9
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

