In this case, you're dealing with a submitted form, and the form name is available through mapping.getAttribute().
hth, Hubert On Fri, 27 Aug 2004 11:58:44 -0400, Paul Spencer <[EMAIL PROTECTED]> wrote: > My web application has a common form that contains the property > "SortOrder". The value of the property is a list of fields used by the > Action for sorting a list. I want my Action to reset the value of the > "SortOrder" to it's initial value, as defined in struts-config.xml. > > When a value of the SortOrder is invalid for the Action, my sort method > throws an exception. In addition I do not want to "default" the > "SortOrder" to the last one used. Thus, I want the Action to reset the > "SortOrder" every time. Since the form contains other properties, I can > not reset the form. > > As an example: > I have 2 Actions, EmployeeAction and TruckAction. > Valid values for "SortOrder" in EmployeeAction are "id, name, hireDate". > Valid values for "SortOrder" in TruckAction are "id, purchaseDate, and > mileage". > > > > Paul Spencer > Hubert Rabago wrote: > > > Unfortunately, you'll have to provide it. ActionForms don't carry the > > name they were declared with. The only object with that information > > is FormBeanConfig. > > There's no surefire failproof way to know what name, if any, is > > associated with a DynaActionForm with just an instance of it. > > > > What are you trying to do? There may be other (better) ways to do > > what you're trying to without messing with FormBeanConfigs and > > FormPropertyConfigs. > > > > On Fri, 27 Aug 2004 11:27:45 -0400, Paul Spencer <[EMAIL PROTECTED]> wrote: > > > >>Hubert, > >>Where do I get the name of the form? > >> > >>Paul Spencer > >> > >> > >> > >> > >>Hubert Rabago wrote: > >> > >> > >>>Well, it ain't that easy: > >>> > >>> // code taken from DynaActionFormClass > >>> DynaActionForm formBean = (DynaActionForm) form; > >>> FormBeanConfig config = > >>>ModuleUtils.getInstance().getModuleConfig(request).findFormBeanConfig("myFormName"); > >>> FormPropertyConfig props[] = config.findFormPropertyConfigs(); > >>> for (int i = 0; i < props.length; i++) { > >>> if ("fieldName".equals(props[i].getName())) { > >>> formBean.set(props[i].getName(), props[i].initial()); > >>> break; > >>> } > >>> } > >>> > >>> > >>> > >>>On Fri, 27 Aug 2004 11:10:03 -0400, Paul Spencer <[EMAIL PROTECTED]> wrote: > >>> > >>> > >>>>How can I reset one field on a DynaActionForm to it's initial value? > >>>> > >>>>Paul Spencer > >>>> > >>>>--------------------------------------------------------------------- > >>>>To unsubscribe, e-mail: [EMAIL PROTECTED] > >>>>For additional commands, e-mail: [EMAIL PROTECTED] > >>>> > >>>> > >>> > >>> > >>>--------------------------------------------------------------------- > >>>To unsubscribe, e-mail: [EMAIL PROTECTED] > >>>For additional commands, e-mail: [EMAIL PROTECTED] > >>> > >>> > >> > >>--------------------------------------------------------------------- > >>To unsubscribe, e-mail: [EMAIL PROTECTED] > >>For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]