I've solved this problem already.  My app is internationalized now.

And so that this e-mail is not totally useless here's an overview of how it's
done.  [Thanks to Craig for sharing his design.]

I have a BundleManager which returns strings (for now) to JSP's requesting
them.  Its getString method takes a name of a string and a locale for which the
string is to be used.  It checks if this bundle is loaded (it has a hashtable
of bundles) and if it isn't it tries loading it.  If it fails loading it it
returns english version of the string (fall back).  If the name of this string
is not in the bundle it returns "-missing resource [name here]-".

In the dispatcher servlet the BundleManager is put into servlet context for
JSP's use.  The locale for current session is also put into session.  The JSP's
take the locale out of the session and BundleManger out of application context
and ask it for strings.

<jsp:useBean id="bundleManager" class="com.instinet.ed.model.BundleManager"
scope="application"/>
<jsp:useBean id="locale" class="java.util.Locale" scope="session"/>

<HTML><HEAD><TITLE><%= bundleManager.getString(locale,"application.name")
%></TITLE>

Works pretty well.

dave.

"Dhondt, Edwin" wrote:

> NoClassDefFoundError
> Do you have perhaps already a class that has the same name as the filename
> of your properties file ?
> Regards,
> Edwin
>
> -----Original Message-----
> From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, December 28, 1999 11:44 PM
> To: [EMAIL PROTECTED]
> Subject: Re: internationalization.2
>
> David Mossakowski wrote:
>
> > I must be doing something *really* dumb but I can't see it.
> >
> > I can load property files OK whether they're in a package or not but not
> classes.
> > Weird.  All I'm trying to do is to load the base class.  Before, when I
> was trying,
> > I was getting the MissingResourceException but now... The error produced
> is this
> > (!):
> >
> > { (Running servlet) java.lang.NoClassDefFoundError:
>
> Usually, a NoClassDefFoundError exception means that one of your classes
> (the one that throws the
> exception) is referring to some other class that cannot be found on your
> classpath.  Do your
> ListResourceBundle classes refer to any Java classes on their import lists?
> Are those actual classes
> visible to the servlet engine when you are running?
>
> >
> > com/instinet/ed/resources/LanguageResources (wrong name:
> LanguageResources)
>
> I have not ever seen this one.  Could you post (or send me privately since
> it is sorta off topic) a snippet
> of one of your ListResourceBundle classes?  I'm interested in the package
> declaration (should be
> com.instinet.ed.resources based on the above), the import statements, and
> the class declaration -- which
> should be something like:
>
>     public class LanguageResources_en_GB extends ListResourceBundle
>
> for the British English version (which should, of course, be in source file
> "LanguageResources_en_GB.java"
> in the appropriate directory for this package).
>
> Craig
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

--
David Mossakowski              [EMAIL PROTECTED]
Programmer                           212.310.7275
Instinet Corporation

"I don't sit idly by, I'm planning a big surprise"

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to