struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ScottC" <scavn...@verizon.net>
Subject Re: Radio active? :-) or a working example of nested radio buttons
Date Fri, 25 Jul 2003 23:16:55 GMT
Adam,

In my case I do not want a correctly nested name (like rows[0].crews[0]...)
if that's what you're referring to, for the text that goes in the name field
and that's what the nested:radio was giving me. Using the idName produces
the correct behavior of making all the name="" all the same and thus
allowing me to have a matrix (usually 6x4) of crew members and by clicking
on one member and getting the "value" returned in the targetMemberId field,
I can continue processing. Now, a strange behavior came up in the parsing of
the value field. I used to have a "," separating my fields so I could break
them apart (i.e. "20030727093000,14236"). Now, when the form is processed
(after I hit submit) only a portion (the 14236) of the value field is
populated back to my property in my form. I don't know how to report this as
a bug because I don't know who (ActionServlet?) is responsible for handling
the request and pulling those values. Below is a snippet of source from the
browser html. As a workaround, I've removed the comma delimiter and I can
parse after the dateTime that precedes the memberId, but boy was I surprised
when I didn't get the whole value field back in my form.


      <td>
         <input type="radio" name="targetMemberId"
value="2003072709300014236">
         Wes Lincoln
      </td>
      <td>
         <input type="radio" name="targetMemberId"
value="200307271100005163">
         John Mims
      </td>

Would I report the parsing problem (or is it normal for special processing
to occur with the value field?) to bugzilla?
Thanks,
Scott


"Adam Hardy" <ahardy.struts@cyberspaceroad.com> wrote in message
news:3F20F64F.8060907@cyberspaceroad.com...
> And that html:radio is able to reference the current iteration of the
> nested:iterate loop, and give the radio html the correctly nested name?
> If so it's seems to be encroaching on the nested taglibs behaviour.
>
> It's good.
>
> Adam
>
> ScottC wrote:
> > Adam,
> > The final code came down to this:
> >
> > <nested:iterate property="rows" >
> >  <tr align="left">
> >
> >    <td>
> >       <nested:write property="rowTitle" />
> >    </td>
> >
> >    <nested:iterate id="crewMember" property="crews">
> >       <td>
> >          <html:radio  idName="crewMember" property="lookup"
value="lookup"
> > />
> >          <nested:write property="memberName" />
> >       </td>
> >
> >    </nested:iterate>
> >
> >  </tr>
> > </nested:iterate>
> >
> > The real key to making it work lies in the idName parameter which
> > nested:radio does not support. The above will make more sense if I
describe
> > my beans. I have a schedule bean that has an ArrayList of rows. The rows
are
> > a class called ScheduleRow. Each ScheduleRow has a title (which is the
> > current date in my case) and an array of crewMembers. My challenge with
the
> > radio button was this, the lookup property is a string inside my
MemberBean
> > (the MemberBean holds the crewmember name and other information) that is
a
> > key field for my database lookup. What is displayed in the jsp is only a
> > crewmember name next to a radio button.  I just couldn't believe it
would
> > take so much effort to get the normal "value" field populated in the tag
> > (using the bean define, etc.) and I hate to admit it, but I RTFM for
> > html:radio and near the top of the doc there is a reference to how
idName
> > when populated totally changes the tags behavior.
> >
> > In summary, if you are tying to create a matrix of radio buttons and are
> > pulling your hair out, try the above approach and see if it works for
you.
> > Here's what the jsp outputs from above:
> >
> > 07/24/2003 *Furner, Bob  *Doe, John      *Smith, James
> > 07/31/2003 *Jones, Bill     *Carey, Harry  *Barber, Joe
> >
> > Collections are cool and nested tags make the jsp very simple, but it's
> > taken me some time to get it working right. Hope this helps anyone else
out
> > there. And to Adam, thanks for taking the time to respond to my plea for
> > help.
> >
> > Scott
> >
> >
> > "Adam Hardy" <ahardy.struts@cyberspaceroad.com> wrote in message
> > news:3F1DB231.2020002@cyberspaceroad.com...
> >
> >>you need someething like this
> >>
> >><nested:iterate property="ops" id="opIterate" indexId="iterateId">
> >>
> >><bean:define name="opIterate" id="currentOp"
> >>               type="foo.bar.operation.OperationValueBean"
scope="page"/>
> >>
> >><nested:radio property="guyName" value="<%=myBean.guyName(); %>" />
> >>
> >>where the bean define allows the radio button to access the current bean
> >>of the iterate loop, and then you can call the name function.
> >>
> >>hth
> >>Adam
> >>
> >>ScottC wrote:
> >>
> >>>I'm having trouble figuring out the nested:radio tag and getting the
> >
> > values
> >
> >>>set. I have bean that nests a list of three other beans (a Schedule
bean
> >>>that holds three date beans). Each date has three guys (each with a
> >
> > radio
> >
> >>>button next to them), so I have an array that is 3x3. How do I get the
> >>>"value" out of the bean to put in the value part of the radio tag? For
> >>>example (where [] is the radio button):
> >>>
> >>>7/21/2003 []Jack []Bob   []Phil
> >>>7/22/2003 []Jim   []Larry []Harry
> >>>7/23/2003 []Paul  []Ken  []John
> >>>
> >>>The nested:radio tag syntax <nested:radio property="guyName" value="?"
> >
> > />
> >
> >>>and I don't understand how to pull the guys name out of the bean and
get
> >
> > it
> >
> >>>in the value parameter. When the form is submitted, I then have to know
> >>>which guy was selected. A working code snippet of something you've done
> >
> > like
> >
> >>>this would be great.
> >>>
> >>>Thanks!
> >>>Scott
> >>>
> >>>
> >>>
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> >>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >>>
> >>>
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
> >




---------------------------------------------------------------------
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