This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara 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


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Seam: Injection doesn't work in custom validator