struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Hill" <andrew.david.h...@gridnode.com>
Subject [Nested] Order of Population of nested properties
Date Mon, 02 Jun 2003 13:56:04 GMT
(Forwarding to list as it looks like Arron's reply didnt make it there)

-----Original Message-----
From: Arron Bates [mailto:struts-user@keyboardmonkey.com]
Sent: Monday, 2 June 2003 21:44
To: andrew.david.hill@gridnode.com
Subject: RE: [Nested] Order of Population of nested properties


As Andrew mentioned, try to get all processing into an Action and out of the
object model.

I find this kind of way gets a little hairy trying to get the object model
to
do processing. Using LazyList from the commons (ListUtils.lazyList()), you
can
simply wait until Struts has done all the request processing, and then
manipulate whatever you want in the handling of the Action. This way you
know
Struts is done, and the object model is at your mercy. It also helps your
piece of mind by knowing that the model is just a bean, and all processing
is
in an Action.

Arron.


> <snip>
> If you must do your thing in the setter then you can use
request.getPara...
> hmm oops! no you cant. You dont have access to the request object there!
> </snip>
>
> Suppose you could save the reference to the request in a member variable
> during the reset() method and refer to it in your setter, but thats
> distinctly 'inelegant'. Unless your in a big hurry Id say go with doing
the
> stuff in the action itself.
>
> -----Original Message-----
> From: Andrew Hill [mailto:andrew.david.hill@gridnode.com]
> Sent: Monday, 2 June 2003 19:42
> To: Struts Users Mailing List
> Subject: RE: [Nested] Order of Population of nested properties
>
> Yeh. There is no gaurantee on the order of population. :-(
>
> If you must do your thing in the setter then you can use
request.getPara...
> hmm oops! no you cant. You dont have access to the request object there!
>
> If its not a multipart form you could do it in the reset() method and use
> request.getParameter() to obtain the values you need but I wouldnt
normally
> recommend that (unless of course you had _already_ created the new rows
and
> fields on the client side using javascript DOM programming - in which case
> you need to create those beans before population occurs!)
>
> I had to do something similar in my app (simple add rows on submit (no
> client side funny business)) so I put the relevant code in the Action that
I
> was submitting to - which simply checks if the "addMoreStuff" property was
> set and adds the necessary rows before forwarding back to the view - (or
> takes other action if it wasnt).
>
> -----Original Message-----
> From: Affan Qureshi [mailto:quereshi@etilize.com]
> Sent: Monday, 2 June 2003 19:35
> To: struts-user
> Subject: [Nested] Order of Population of nested properties
>
> Hi,
> I have an implementation just like the monkey-tree example where I have a
> button to add more fields in a form dynamically. The button is a Submit
> button which is mapped to a nested bean's property. By default the the
> button adds one set of nested (recursively) fields. I want it to add
> user-defined no of rows. For that I have a text field mapped to another
> property of the same nested bean. I get that value and add the specified
no
> of rows. It works fine but sometimes I get the following problem.
>
> Sometimes properties are populated before the other which causes great
> confusion. E.g if the 'noOfFieldsToAdd' property is populated after the
> 'addMoreFields' (the button) property I wont get the correct output. Also
I
> see that some properties are populated twice instead of once which is also
a
> bit confusing.
>
> Is there any order in which the fields are populated? Can i control this?
Or
> maybe I am using it in the wrong way?
>
> Thanks a lot.
>
> Affan


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


Mime
View raw message