A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Murach's Java Servlets and JSP
this week in the
Getting MessageResources in ActionForm Validate
Joined: Jul 09, 2007
Sep 07, 2007 02:32:00
This question might have been asked many times but I have tried googling for sites but found no answers yet.
I just want to know on how I can have a reference on the nice MessageResources class of Struts in my action form validate method so
I wont hardcode my messages?
I have tried the following code but it was deprecated already.
MessageResources resource= (MessageResources)request.getAttribute(Action.MESSAGE_KEY);
I also found this piece of code but it keeps on returning null messageresource object.
MessageResources resource= (MessageResources)request.getAttribute(Globals.MESSAGE_KEY);
I know I can get it from my action class but I need to know if I could access it in both the validate and reset method of the action form. Thanks!
Sean Clark ---> I love this place!!!
Me ------> I definitely love this place!!!
It is sorta covered in the
JavaRanch Style Guide
subject: Getting MessageResources in ActionForm Validate
Struts Message resources
Getting values from properties in validate-using multiple message-resources in struts
Struts validation not displaying error messages
Getting MessageResources inside ActionForm
Reading the message resources from a form class
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014