Me too. -----Mensaje original----- De: David Graham [mailto:[EMAIL PROTECTED]] Enviado el: lunes, 30 de septiembre de 2002 15:34 Para: [EMAIL PROTECTED] Asunto: Re: SURVEY: Proper Way To Pre-populate ActionForms
I do the same as Eddie. Put an action in front of the form that sets its initial values. Dave >From: "Hohlen, John" <[EMAIL PROTECTED]> >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> >To: "Struts-Help (E-mail)" <[EMAIL PROTECTED]> >CC: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> >Subject: SURVEY: Proper Way To Pre-populate ActionForms >Date: Mon, 30 Sep 2002 08:22:29 -0500 > >I was wondering what the overall philosophy is in the Struts Users >community >in regards to pre-populating action forms? I sent a message out late last >week asking for help on how to manually instantiate and pre-populate an >action form (prior to forwarding to a JS) in Struts 1.1. That's when I >realized this may be considered bad practice. Here are some comments I >received: > >Eddie Bush: >"No, no. Actions/Forms have a contract -- the form 'will' be created. >You should not take this upon yourself. What you need to do is pre-face >the page with a 'populate' action. Expect it to be there" > >James Turner: >I can still point to cases where you need to manually pre-populate. >For example, if you have multiple forms on a single JSP page, you either >need to pre-populate the forms manually, or you'd have to daisy-chain a >bunch of actions together, each one of which was responsible for >pre-populating a single form. This seems clumsy to me. Maybe what we need >is an authoritative way (i.e., an API) to instantiate DynaForms. > >What are others doing here? BTW, if manually pre-populating an action form >is acceptable, does it make sense to create a method in the "RequestUtils" >package making this >easy to do for a DynaForm (Struts 1.1). For example (code provided by >James >Turner): > >ApplicationConfig appConfig = > (ApplicationConfig)request.getAttribute(Action.APPLICATION_KEY); >FormBeanConfig formBeanConfig = > appConfig.findFormBeanConfig("myDynaActionForm"); >String beanType = formBeanConfig.getType(); >DynaActionForm bean; >DynaActionFormClass formClass = > >DynaActionFormClass.createDynaActionFormClass(formBeanConfig); >return (DynaActionForm) formClass.newInstance(); > >Thanks! JOHN > > >-- >To unsubscribe, e-mail: ><mailto:[EMAIL PROTECTED]> >For additional commands, e-mail: ><mailto:[EMAIL PROTECTED]> _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>