This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Struts and the fly likes Database Message Resources Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "Database Message Resources" Watch "Database Message Resources" New topic
Author

Database Message Resources

supriya pelluru
Greenhorn

Joined: Mar 11, 2008
Posts: 4
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 .
Anubhav Anand
Ranch Hand

Joined: May 18, 2007
Posts: 341

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.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Database Message Resources
 
Similar Threads
getting error messages from database using struts
Database Message Resources
Reading the message resources from a form class
Database Message Resources
Accessing the Struts Application Resources in XSL