fea jabi wrote: > This might not be exactly displaytag question. But hoping to get help. > > have a display tag table > > in one of the columns have <html:text>. not all rows have the <html:text> > in > this column.(<html:text> struts tag) > > need to validate the user entered values in the <html:text> using > validator.xml (of Struts). > > Created an object.java file which holds the row data of the table. > Created > a list of these row objects. > > Not sure how to proceed now. should I put the List as a property in the > form-bean?? if I did so how will the user edited <html:text> updated to > the > list so that I can do validations?
This is one of the more difficult things to do without resorting to either really butt-ugly solutions (e.g. naming form vars things like "textnn" where nn is a number representing the list index of the object and having to do string parsing of the var names and mapping of the params, etc.) or somewhat difficult config and deployment schemes. What I'd recommend is looking at the BeanUtils package. Off the top of my head, I can't remember exactly how the var naming works, but you end up with something like this: <input type="text" name="myText[nn]"> Again, in this case, nn is the index of the object in the list (it can also be a key to a map), but BeanUtils handles translating this into the appropriate object and property. Or maybe something like this: <input type="text" name="myList[nn].myTextProperty"> Where the myList[nn] translates to the correct object in the list and the indicated property on that object gets set to the value. Also, note that while I'm just using a straight <input> tag, this works just as well for the Struts <html:text> tag. Sorry I can't give you more explicit info on how to set this up, as it's been quite a while since I've done it (I've been doing .Net development for the past few months :^P). And it's sort of complicated to get working correctly, so I'd recommend setting up a real simple sandbox application where you can get it working with a small data set. But basically BeanUtils gives you the ability to handle beans, maps, lists, etc. with the familiar dot notation you use with ELs, displaytag, etc., such as bean.listProperty[index].mapProperty[key].property. -- Rick Herrick [EMAIL PROTECTED] I haven't got time for inner peace. "No reasonable definition of reality could be expected to permit this."--Albert Einstein, Boris Podolsky and Nathan Rosen in 1935 Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ displaytag-user mailing list displaytag-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/displaytag-user