This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Other Application Frameworks and the fly likes Seam: Injection doesn't work in custom validator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Seam: Injection doesn Watch "Seam: Injection doesn New topic
Author

Seam: Injection doesn't work in custom validator

Dan Duarte
Greenhorn

Joined: Dec 02, 2010
Posts: 2
Hi guys,
I'm new seam development and i'm having littles problems with my app.
I've created a object that encapsulate the message bundle. so I try to inject this object in my custom validator, but at runtime i receive a null value.



anyone could help me?
Andrea Moehrke
Greenhorn

Joined: Dec 09, 2010
Posts: 2
Hi,

try to get the ResourceBundle on this way:

Locale locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
ResourceBundle messages = ResourceBundle.getBundle( "messages", locale, Thread.currentThread().getContextClassLoader());

Dan Duarte
Greenhorn

Joined: Dec 02, 2010
Posts: 2
Andrea Moehrke wrote:Hi,

try to get the ResourceBundle on this way:

Locale locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
ResourceBundle messages = ResourceBundle.getBundle( "messages", locale, Thread.currentThread().getContextClassLoader());



I just instantiate a new object in the validator
Messages mensagens = new Messages();
so, it works.

Another problem that I realize is, if I put the code above in the validator, a exception occur

code


exception
 
GeeCON Prague 2014
 
subject: Seam: Injection doesn't work in custom validator