-
1. Re: portlet resource bundles
joehobson Mar 23, 2005 7:26 PM (in response to joehobson)Ok, i figured out that problem, after more research on these forums and elsewhere. For those reading this that might be like the answer... the name of the properties file needs to be com.mycompany.Whatever.properites, not in that directory location. I guess it doesnt really matter too much what the name of the prop file is, but a full package name will keep it from stepping on others.
Now, for the next question - i18n with a jsp file. I know JBP uses its own tld functions for i18n. For portability's sake, is it possible to use the standard fmt.tld JSTL functions? I haven't been able to get these to work within JBP though. My guess is that it doesn't load the resource in a way that the jsp engine can find it, or i'm not setting the bundle properly. Not sure. So i set my resource-bundle in the portlet.xml, and then i use this code within the jsp...<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> <fmt:setBundle basename="com.portalbook.portlets.todo.todoResourceBundle" /> <fmt:message key="mykey" />
But the page output just has "???mykey???" where the text should be. I put the JSTL standard.jar in my portlet's lib, but still no luck. Anyone accomplished this, outside of the JBP n:i18n(key) functions?
thanks. ... .joe -
2. Re: portlet resource bundles
joehobson Mar 25, 2005 7:35 PM (in response to joehobson)This appears to be a bug in JBP. The way the portal loads resource files for portlets does not seem to match the standard, or the way it loads for jsp views. So from what i have seen, to load a properties file for portlet (java) access, i must name the file something like com.something.BlahPortlet.properties and place it in the /classes/ directory of the war. That works fine, until i try to access those properties from included jsp files. To access from jsp, the properties file should be in the path /com/something/BlahPortlet.properties
JBP fails to find the resource bundle file in the path, for portlet code. I tired the same war on a simple Pluto 1.0.1 install and it worked just fine, for jsp and java code.
I've also noticed that JBP failes to load a portlet if javax.portlet.title is defined in the resource bundle and not directly in the portlet.xml file. This is all on Alpha, havent tried on Beta yet. I can get more detailed in bug report if someone doesn't have more info to convince me that it's not a bug. ... .joe -
3. Re: portlet resource bundles
julien1 Mar 25, 2005 8:26 PM (in response to joehobson)this bug has been fixed since alpha
-
4. Re: portlet resource bundles
joehobson Mar 28, 2005 2:16 AM (in response to joehobson)Thanks Julien, that was it. The portlet code and jsp both work well now with the resource bundle. ... .joe