You can get the resources using the following: MessageResources resources = (MessageResources) request.getAttribute(Action.MESSAGES_KEY)
--- "Taylor, Jason" <[EMAIL PROTECTED]> wrote: > I posted a question to the struts-user group asking how one could get a > Resource bundle from within the ActionForm.reset() method. The way I've > been doing it was to use the ActionServlet.getResources() method, but it's > now deprecated. I tried just making a new Action object and using the > Action.getResources(HttpServletRequest), but it's a protected method. > > The best response I got from the user group was "don't use reset()", which > seems a bit counter-productive. > > If noone on the dev knows of a way to do this, I'd suggest adding a > getResources(HttpServletRequest) method to either the ActionForm or > ActionServlet class. Any thoughts? > > -JT > > -----Original Message----- > From: Taylor, Jason > Sent: Saturday, September 21, 2002 12:21 PM > To: 'Struts Users Mailing List' > Subject: RE: getting MessageResources within ActionForm.reset() > > > Because I have a dynamic array of checkboxes which must be created in > reset() before the controller automatically populates the ActionForm, I need > to use the ActionForm.reset method. If I > don't do the initialization in reset(), I can't use the controller to > initialize, populate and validate the form, and I may as well not use an > ActionForm. > > Bottom line, there should be a way to get Resources in ActionForm.reset()-- > there's no good reason I can see why you'd need system properties in the > Action class but not the ActionForm class. The reset method receives the > request object, so you don't have the problem that the deprecated > ActionServlet.getResources() method had (i.e., no request argument to > indicate *which* bundle you want). > > What I would like to know is why the deprecated method wasn't replaced with > ActionServlet.getResources(HttpServletRequest) rather than > Action.getResources(HttpServletRequest). > > Anyone know of any way to get Resources within the ActionForm before I post > it to struts-dev? > > -JT > > -----Original Message----- > From: Bryan Hilterbrand [mailto:[EMAIL PROTECTED]] > Sent: Saturday, September 21, 2002 11:29 AM > To: Struts Users Mailing List > Subject: Re: getting MessageResources within ActionForm.reset() > > > Why don't you do your initialization in the action method? > > Bryan > > ----- Original Message ----- > From: "Taylor, Jason" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Saturday, September 21, 2002 12:06 PM > Subject: getting MessageResources within ActionForm.reset() > > > Since the ActionServlet.getResources() method is now deprecated, you need a > request and an Action object to get Resources. That's fine so long as > you're operating within the Action class, but if you're in the ActionForm > object and you want to get Resources, you can't because > Action.getResources(HttpServletRequest) has protected access. > > Am I missing something or is this a job for struts-dev? > > -JT > > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>