tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Honza Spurný <spu...@master.cz>
Subject MessageResources in Model
Date Thu, 26 Aug 2004 12:49:13 GMT
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


Mime
View raw message