struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Cancro <DCan...@bridgespan.com>
Subject RE: getting nested tags to work with DynaActionForm???
Date Wed, 17 Jul 2002 00:00:18 GMT
I'd like to see what you've written.  

Here's how I understand it so far:
http://members.telocity.com/dcancro/images/eng/Struts_MVC.gif



> -----Original Message-----
> From: Roman Fail [mailto:rfail@posportal.com]
> Sent: Tuesday, July 16, 2002 4:35 PM
> To: Rick Reumann; Struts List
> Subject: RE: getting nested tags to work with DynaActionForm???
> 
> 
> I had the same problem - after reviewing the source code for 
> DynaActionForm I realized that the underlying ArrayList is 
> not 'automatically' instantiated by the DynaActionForm.  In 
> other words, when the controller is trying to call 
> DynaActionForm.set("myField[0]") because it sees a request 
> parameter called 'myField[0]', there is no ArrayList there 
> yet to match the "myField" property.  My solution was to 
> subclass DynaActionForm and just override the reset() method 
> in order to instantiate the ArrayList.  (since reset() is 
> called before any setters).  I think I also did this using an 
> array of BasicDynaBeans, and again had to initialize the 
> array in reset().  
>  
> Of course you don't have to do this when simply displaying 
> the data, because you are populating the property with your 
> ArrayList in Action.perform()/execute() before the 
> DynaActionForm.get() methods are ever called.  
>  
> Is there a better solution out there?  I don't like having to 
> write a subclass just to instantiate the ArrayList.
>  
> This is another example of where knowing the exact sequence 
> of Struts events is crucial.  Has anyone ever written up a 
> detailed step-by-step of what the controller does when a 
> request comes in?  I've written a brief one for our company's 
> developers - shall I post it?
>  
> Roman Fail
> Sr. Web Application Developer
> POS Portal, Inc.
>  
> 
> 	-----Original Message----- 
> 	From: Rick Reumann [mailto:maillist@reumann.net] 
> 	Sent: Tue 7/16/2002 1:33 PM 
> 	To: Struts List 
> 	Cc: 
> 	Subject: getting nested tags to work with DynaActionForm???
> 	
> 	
> 
> 	I had an ArrayList property set in my DynaActionForm 
> and it worked
> 	fine with the nested tag in displaying the information 
> from the beans
> 	in the ArrayList of this DynaActionForm. The problem 
> however came when
> 	I when I hit submit with the updated information. I kept getting
> 	BeanUtils.populate errors with no index value set for 
> 'field.xxxx[0]'.
> 	Sorry can't cite the exact error since I now went to 
> using a typical
> 	ActionForm and the nested tag page submits fine.
> 	
> 	Is there something special I need to do in order to get
> 	DynamicActionForms to work with Nested tags?
> 	
> 	Thanks,
> 	
> 	--
> 	
> 	Rick
> 	mailto:maillist@reumann.net
> 	
> 	
> 
> 

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message