Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Seam: Injection doesn't work in custom validator

 
Dan Duarte
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic