You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.
| Online: | 30 Members of 4186 |
| Forum: Seam Users |
19. Feb 2008, 20:30 CET | Link |
I would like to have a resource bundle with another name than messages*, for instance constants.properties. How do I do this?
What I tried without success
Added the following to components.xml
<core:resource-loader>
<core:bundle-names>
<value>constants</value>
</core:bundle-names>
</core:resource-loader>
And in the build.xml created by seam-gen, the two places where it said
<include name="messages*.properties"/>
I added
<include name="constants.properties"/>
And created a constants.properties in the resource directory
/Dam
This is the correct approach. Does the constants.properties file get copied to the deployed archive next to messages.properties?
Read about how to report a bug.
Yes it does.
Just found out that if I put this in the view
I have access to it. But I would also like to have access to it, from the beans.
How are you referencing the properties?
I can set up a new resource bundle in components.xml named mycompany_messages.properties
<core:resource-loader> <core:bundle-names> <value>mycompany_messages</value> </core:bundle-names> </core:resource-loader>But I still reference it in the JSF as
<h:outputText value="#{messages['mylabel']}"/>...not...
<h:outputText value="#{mycompany_messages['mylabel']}"/>IOW, you're just specifying additional properties files for the org.jboss.seam.core.resourceBundle component.
I was refering to it as
#{constants.foo}because I thought of constants as a separate map, so that explains it:)
By the way is it possible to have more than one map?
No.
Read about how to report a bug.