tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Darryl Stoflet <dstof...@calweb.com>
Subject Re: ResourceBundle in JSP
Date Sat, 18 Mar 2000 01:33:55 GMT
Christopher,

	Just curious, have your tried placing the resource on the
system classpath. Jsp's, all file extension mapped servlets, and
all default servlets seemed to be loaded by the 
system classloader (aka appclassloader). ResourceBundle.getBundle
will use that classloader to find the resource. Unfortunately that
classloader will not know about your web-inf/classes directory
and thus will fail to find your resource.
The HelloWorldExample serlvet is within the examples context and
thus is loaded by the AdaptiveServletLoader which is context path 
aware and thus can find the resource.

Please let me know how that goes as I am looking into issues related 
to this. 

I do think that this highlights a problem where one would assume that
their jsp located in a context is aware of that context in the sense
that it could load resources relative to that jsp's context. However
that is not the case since the org.apache.jasper.runtime.JspServlet
jsp handler is loaded not by the context aware AdaptiveServletLoader
but by the system classloader and thus not aware of the jsps context.
The only way that I could see this issue being solved is if each context
has its own instance of each file ext. mapped servlet and default 
servlet (all loaded by that context's AdaptiveServletLoader). 
I'm be curious if anyone has any opinion on this. 

/Darryl Stoflet

Christopher Stacy wrote:
> 
> I am looking at the HelloWorld example servlet, and it does
>   ResourceBundle.getBundle("LocalStrings")
> which finds the LocalStrings.properties file in the WEB-INF/classes directory,
> (the same directory as the HelloWorldExample.java file lives).
> 
> I tried to duplicate this by making the same call from JSP, but that
> results in Internal Servlet Error:
>     java.util.MissingResourceException:
>     Can't find bundle for base name LocalStrings, locale en_US
> 
> That sounds to me like it was just about ready to work, but that I need
> to put the LocalStrings.properties file in the right place.
> I tried several different places to no avail.
> Where does it go?
> 
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org

-- 
Darryl Stoflet
http://dstoflet.calweb.com

Mime
View raw message