Problem with getMessageBundle()

Hello, excuse me for my english but I am an italian student. I have the following problem:

I use <f:loabBundle basename="ApplicationResources" var="bundle" /> in a JSP page.

Inside a JavaBean, I have a simple method with the following lines of code :

..

..

FacesContext context = FacesContext.getCurrentInstance();

String msgBundle = context.getApplication().getMessageBundle();

..

..

With the Debug, I have observed that getMessageBundle() return "null".

Why ?

[535 byte] By [cubanitoa] at [2007-10-2 6:40:49]
# 1

Did you set your message bundle in the faces-config.xml?

Something like this:

<application>

<message-bundle>jsf.Messages</message-bundle>

<locale-config>

<default-locale>en</default-locale>

</locale-config>

</application>

Also, if you use a loadBundle on your page, this will just allow you to access that bundle from the page. The "var" you set can be accessed to output messages from the bundle. Like this (using your example):

<h:outputText value="#{bundle.messageKey}" />

That should be a good start for you at least.

CowKing

IamCowKinga at 2007-7-16 13:49:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...