• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Database Message Resources

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi to all


In general we get the validation error messages in struts from message resources . But i want to get that error messages from database .For that , i want suggestions . please reply me .
 
Ranch Hand
Posts: 341
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
supriya pelluru,
Welcome to JavaRanch.

Well, as far as *I* think, bringing error messages from database is not a good idea. Talking to databse requires heavy use of resources and an error situation in itself lead to resource locking (at times, not necessarily).

So, on the first *I* feel it would be a bad coding practice and moreover, a bad idea as well when we have message resource file.

But, somehow we we have a constraint to get the error messages from database then too the process goes the same way. Ideal practice will be to make your own exception handler which will fill the messages from database.
Once you get an error and reach the catch block. Just bundle that exception in your custom exception type and call your exception handler.

Another way(but, it's exhaustive) yet bad, is to get all mesasages from DB and store in some temporary session variable and use it appropriately.

Whatever be the case, *I* still feel weird about it and suggest to stick to message resource file.
 
You will always be treated with dignity. Now, strip naked, get on the probulator and hold this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic