Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EL functions in FACELETS...

 
Arun Thulaseedharan
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys,
my question is when we are using EL FUNCTIONS for internationalization we are making use of tat static function to read the message properties file and locale and get the things accoridng to the locale from the properties....
my doubt is,is it possible to retrieve the datas from a database which we usually get from the properties file using the functions present in facesContext...if its possible, is ther any defualt functions available for doing the same as we hav for message property files....

thanks in advance,
thanks and regards,
arun
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18094
48
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should be able to overload the Properties class and make its load method do the loading from a database. Nothing JSF-specific needed.
 
Arun Thulaseedharan
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that means we dont have any functions in the api which allow us to retirve frm database and we should use our own functions in that class???

thanks in advance,
arun
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18094
48
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing specific to JSF. You can probably find some samples of utility classes that overload the Properties load() method using a database as a source.

There are 2 main reasons why nothing specific to DBMS's:

First, because you can arrange the properties in the DBMS however you like and different people like different ways. There's no "one-size-fits-all" solution.

Secondly, flat files and DBMS's aren't the only ways to get properties. I could use LDAP, a web service, even the Fairy Courier Delivery Service. So rather than try for every possible specific solution, they made the Properties class extensible.

A DBMS-loaded Properties class shouldn't be too difficult. Just extend java.util.Properties and overload the load() method with one that opens the connection to the DBMS, reads the key/value pairs and does a "this.setProperty()" against each. And closes the connection when you're done, of course.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic