You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Honza Spurný <sp...@master.cz> on 2004/08/26 14:49:13 UTC

MessageResources in Model

Hi there,

I know this is not request for Tomcat mailing list, but since I could not
connect to struts mailing list, I've tried last chance here :o) Thanks for
understanding.

I have my own class called CountrySeparator:

public class CountrySeparator {
...
}

I'd like to use messageResources here in some method, so I have design this
method:

public static String getSomething(HttpServletRequest, String key)
{
    // I have locale stored in session
    Locale locale = (Locale)request.getSession().getAttribute("locale");
    MessageResources messages =
        ((MessageResources)request.getAttribute(Globals.MESSAGES_KEY));

    return messges.getMessage(locale, key);
}

BUT on the line with
    return messges.getMessage(locale, key);
command, it throws exception about null pointer. When I try to printout the
messages object, it writes me "null" :(

So it means, that I has not been able to access MessageResources object.

What I'm supposed to do to acccess this object?

Please could anybody help?

Thanks a lot.

Sporak


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org