On 2/1/06, Jim Reynolds <[EMAIL PROTECTED]> wrote: > I am having issues working with the html:radio tag. > > First off: I have simple bean which extends ActionForm. In my > business logic I create DTO objects and stuff them into the actionform > into a arrayList through a setter. The DTO has a getName method in it. > > In my view, I am iterating over like so, and all is GOOD. It spills > out what I want: > > <logic:iterate id="sb" name="abcForm" property="daList" > indexId="index" offset='5'> > <bean:write name="sb" property="name" /> > </logic:iterate> > > > According to the Struts Cookbook I then do this to get a radio button: > > <logic:iterate id="sb" name="abcForm" property="daList" indexId="index" > offset='5'> > <html:radio property="name" idName="sb" value="name" /> > <bean:write name="sb" property="name" /> > </logic:iterate> > > Whenever I do this with idName it complains that it cannot find the > getter for name, even through I am printing it out above with the > bean:write tag???? > And if I just use name, then it prints out the value as a string and > does not interpret it. > > I have never been able to get this to work correctly inside a logic:iterate > tag? > > Anyone .... ever pull this off?
In this: <logic:iterate id="sb" name="abcForm" property="daList" indexId="index" offset='5'> <bean:write name="sb" property="name" /> </logic:iterate> 1) you select absForm.daList.get(i) ==> sb, where i = 5..n 2) you write sb.name In this: <logic:iterate id="sb" name="abcForm" property="daList" indexId="index" offset='5'> <html:radio property="name" idName="sb" value="name" /> <bean:write name="sb" property="name" /> </logic:iterate> 1) you select absForm.daList.get(i) ==> sb, where i = 5..n 2) you create radiobutton, which is checked if sb.value == <currentForm>.name, where <currentForm> is the actionform defined for the action, that is used in your HTML FORM. 3) you write sb.name What you probably want to do is: <logic:iterate id="sb" name="abcForm" property="daList" indexId="index" offset='5'> <html:radio name="yourActionForm" property="yourCurrentRadiobuttonValue" idName="sb" value="name" /> <bean:write name="sb" property="name" /> </logic:iterate> name="yourActionForm" is optional if yourCurrentRadiobuttonValue is defined in currentForm. See this article, it explains it very well: http://javaboutique.internet.com/tutorials/strutsform/index-3.html Michael J. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]