Help

Controls

PermLinkWikiLink

Built with Seam

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.

Forum: Seam Users Forum ListTopic List
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

5 Replies:
19. Feb 2008, 21:57 CET | Link

This is the correct approach. Does the constants.properties file get copied to the deployed archive next to messages.properties?

19. Feb 2008, 22:09 CET | Link

Yes it does.

Just found out that if I put this in the view


<f:loadBundle basename="constants" var="constants"/>

I have access to it. But I would also like to have access to it, from the beans.

19. Feb 2008, 22:18 CET | Link

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.

Rating:  * * * *
19. Feb 2008, 22:33 CET | Link

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?