I've been doing some research on how the request parameters are mapped
to form bean properties. I just haven't been able to find much
documentation on this. I was wondering if someone could point me in the
right direction. I think I understand the basics of simple request
parameter to property name mapping. The complexities and rules of index,
mapped, nested syntax are still a bit vague.

Reason: I'm using Struts for the model and controller but I'm not using
it for the View. I'm using Velocity instead (tastes great, less
filling). I'd like to fully understand the capabilities of the
RequestUtils.populate() method that fills the bean from the request
parameters so I can use the naming pattern properly when building forms
in Velocity. I've been pouring through the code in the jakarta-commons,
but it seems to me that this request parameter naming pattern should be
documented somewhere already...but I've overlooked it.

What I think I understand:
                              
     Request parameter        resulting form bean invocation
     -----------------          ------------------------------
     name=John                setName( "John" )

     amount=123               setAmount( 123 )

     item[2]=apple            getItem()[2] = "apple"
                                 (where getItem() returns an Object[])
                               -- or --
                                        getItem().set(2,"apple")
                                 (where getItem() returns a List)

     propMap(name)=John       getPropMap().put( "name", "John" )
                                 (where getPropMap() returns a Map)

     colors=green
     colors=blue              setColors( new String[] { "green" , "blue"
} )
                                 (where setColors() returns an Object[])

     brands=Sony              setBrands( new String[] { "brands" } )

     order.amount=84          getOrder().setAmount( 84 )

     order.item[5].propMap(name)=John
                              getOrder().getItem()[5].getPropMap().put(
"name", "John" )

Please correct or add new (and interesting) examples to this to help us
all.

Another question: Is there any standards for request parameter naming
for other server technologies (i.e. CGI, PHP, etc?)

Thanks for any input.

bill



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to