Richard Rozema wrote the following on 4/7/2005 5:57 PM:
I'm pretty new on struts programming and I've read to avoid using session. The only real reason I see not to use session is that if I stick 2 instances of my search tile in the same page (and I will do so), they will share the same property names in the session. Or do you think they will not overwrite each others values?
I've never added two instances of a tile with a form in it into a page, so I'm not sure of the effect. I'm not really sure of the concept of what you are trying to do there.
You could be right here, I introduced the indexed properties because the searchForm may contain from 1 to any number of properties to select on depending on the table being searched. Each line in the form contains one property for which the end user may select an operator to build a selection criterium and enter values. But how else will I be able to determine which operator to apply to a property and it's value(s)? or in other words, how do I keep the property name, operator and values of each line grouped together?
Sorry, I should have been more clear, I've been using the nested tag so long I forgot that for what you wanted to do you WOLD need indexed properties unlss you did use the nested tag (part of Struts) or simply made the indexed values yourself with JSTL (which is what I opt for when not using the nested tag, only because I'm not sure how indexed works when you end up with deeply nested objects within objects(?)).
The nested tag will take care of this cleanly for you. So, for example, if you had a List of Employees (firstName, lastName, and inside each Employee was also a "AddressBean" with street, city,etc) your formBean might just have a settter getter for getEmployees() setEmployees(List employees). Then creating the form..
<nested:form action="someWhere"> <nested:iterate property="employees"> <nested:write property="firstName"/> <nested:write property="lastName"/> <nested:write property="address.city"/> <nested:write property="address.state"/> </nested:iterate>
or if you don't like address.city, address.state you could do...
<nested:form action="someWhere"> <nested:iterate property="employees"> <nested:write property="firstName"/> <nested:write property="lastName"/> <nested:nest property="address" > <nested:write property="city"/> <nested:write property="state"/> </nested:nest> </nested:iterate>
-- Rick
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]