struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Howard Miller" ...@howardmiller.co.uk>
Subject Re: Nested Indexed Property
Date Sat, 21 Sep 2002 20:39:07 GMT
The problem is that I don't know the best way to do what I want to do.

Data structure looks like this

Bean A contains Linked List
  List Item 0 
  List Item 1
  List Item 2
  ....
  List Item n

Each List Item points to a bean. This bean looks like (for arguments sake - its more 
complicated than this)...

Bean B.Name
Bean B.Address

I have a screen that lists the linked lists and invites the user to edit any of the objects

in the list - remember they already exist and are populated (read from database).

So the edit button points (indirectly or otherwise) to the next page which contains a 
form to edit the data (ie, the bean POINTED TO by the linked list). But now I have 
problems.

1. What do I put in the <html:form> tag and the config xml for that matter. 
2. How do I have the fact that the bean already exists
3. How do I handle the fact that the bean to use is unknown until run time
4. How do I handle the fact that the bean is referenced by an ArrayList

I basically need to edit the contents of a bean that is dynamically allocated to the form

at run time. The structure of the bean IS fixed though, so I don't think I'm talking 
about DynaBeans. 

I have thought about (in the action called from the first page) creating a new bean in 
the request scope just containing the selected bean from the list. This gets really 
confusing and has issues of its own.

Does this make more sense? I'm really stuck here!!! Any help greatly appreciated.

Howard

On 21 Sep 2002 at 16:19, V. Cekvenich wrote:

> Not sure what your question is:
> If you want to do multi row displays or multi row displays, I have beans 
> that implement iterator or collection (getRow).
> If your want to update multiple beans, you can have such beans within a 
> bean.
> 
> If you have issues with setters, you can unit test them outside of 
> Struts or webapps.
> 
> If you have issues with parms or attributes, you can debug them my 
> iterating all the attributes/parms for request/session and see what you 
> have.
> 
> Try going step by step. Test the setter. Test the parms. Test the 
> iteration. (To me, the main attraction of MVC is that you can unit test 
> each component before using it).
> V.
> 
> 
> Howard Miller wrote:
> > Hi,
> > 
> > Sorry for repeating myself, but I think having read a lot more I can ask the question

> > with a bit more "intelligence".
> > 
> > To set the scene may I quote from the documentation:
> > 
> > "You may also place a bean instance on your form, and use nested property 
> > references. For example, you might have a "customer" bean on your Action 
> > Form, and then refer to the property "customer.name" in your JSP view. This 
> > would correspond to the methods customer.getName() and 
> > customer.setName(string Name) on your customer bean"
> > 
> > fine... BUT what if name is a property of an object in the LIST customer. So 
> > (working backwards) I want to create the reference:
> > customer.get( i ).setName(string Name) (oversimplified I know).
> > 
> > BUT it gets worse.... the index, i, is actually a property set on the previous JSP

> > page... so its more like
> > customer.get( reqest.getParameter( "index" ) ).setName(string Name )
> > ...and of course the form action needs to properly read the current values into

> > the form text fields and then set them back into the correct place. I have no 
> > clue how to do this! Any offers?
> > HM
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>
> 
> 



--
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