You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Bensman, Jeff [EESUS]" <JB...@EESUS.JNJ.com> on 2002/07/24 15:02:31 UTC

Number of Radio button groups not known until run-time

I'm somewhat of a struts newbie, but I have researched this problem through
all available means I'm aware of, and I now humbly turn to this list for
assistance.

I'm trying to use a Struts ActionForm (v 1.0.2) to deal with a situation
where I don't know the number of radio button groups until run-time.
 
For example, imagine a table where every row is some product a company
sells, and there is a column with a yes/no radio button group. I need the
yes/no decision for every product, but the product list is dynamic and not
known until runtime. 

I tried to eliminate half of my problem by generating the input page
through old fashion means rather than using <html:radio> tags.
Instead, I've tried using iteration to get resulting HTML in each row of
my table that looks like this: 

<input type="radio" name="decision[1]" value="yes" />
<input type="radio" name="decision[1]" value="no" />

and then of course I increment the counter, so 1 becomes 2 on the next
row, and so on and so on... 

I've setup the ActionForm used in the page I post to like this: 

private String[] decision= {};
public void setDecision(String decision[]) 
public String getDecision(int i)
public String[] getDecision()

However, as Struts populates the form it generates a BeanUtils.populate
error. I checked out the source code, and while I see a line that checkes
for the "[" in the name, it doesn't appear to do anything with this 
information.

And remember, these are radio buttons, so each row of my table needs a 
unique name in order for the radio buttons to work as desired.  I can't
give them ALL the same name, or making a decisino on one row would undo
my decision on any other row.

Any ideas how I can do this sort of thing without simply bypassing the use
of the ActionForm?

Thanks in advance for any advice.

BTW, the search of the struts-user list at 
http://www.mail-archive.com/struts-dev%40jakarta.apache.org/ appears to be
down.
For the last several days I get an error message for any type of search.  I
sent the error to webmaster@mail-archive.com as instructed by the error
message
but I haven't heard anything yet.  Does anyone else see this problem?

RE: Number of Radio button groups not known until run-time

Posted by Arnaud HERITIER <ah...@sopragroup.com>.
I think it can help you :

http://nagoya.apache.org/eyebrowse/ReadMsg?listName=struts-user@jakarta.apac
he.org&msgNo=40180

But you'll need to use struts 1.1 !

> -----Message d'origine-----
> De : Bensman, Jeff [EESUS] [mailto:JBensman@EESUS.JNJ.com]
> Envoyé : mercredi 24 juillet 2002 15:03
> À : 'struts-user@jakarta.apache.org'
> Objet : Number of Radio button groups not known until run-time
>
>
> I'm somewhat of a struts newbie, but I have researched this
> problem through
> all available means I'm aware of, and I now humbly turn to
> this list for
> assistance.
>
> I'm trying to use a Struts ActionForm (v 1.0.2) to deal with
> a situation
> where I don't know the number of radio button groups until run-time.
>
> For example, imagine a table where every row is some product a company
> sells, and there is a column with a yes/no radio button
> group. I need the
> yes/no decision for every product, but the product list is
> dynamic and not
> known until runtime.
>
> I tried to eliminate half of my problem by generating the input page
> through old fashion means rather than using <html:radio> tags.
> Instead, I've tried using iteration to get resulting HTML in
> each row of
> my table that looks like this:
>
> <input type="radio" name="decision[1]" value="yes" />
> <input type="radio" name="decision[1]" value="no" />
>
> and then of course I increment the counter, so 1 becomes 2 on the next
> row, and so on and so on...
>
> I've setup the ActionForm used in the page I post to like this:
>
> private String[] decision= {};
> public void setDecision(String decision[])
> public String getDecision(int i)
> public String[] getDecision()
>
> However, as Struts populates the form it generates a
> BeanUtils.populate
> error. I checked out the source code, and while I see a line
> that checkes
> for the "[" in the name, it doesn't appear to do anything with this
> information.
>
> And remember, these are radio buttons, so each row of my
> table needs a
> unique name in order for the radio buttons to work as
> desired.  I can't
> give them ALL the same name, or making a decisino on one row
> would undo
> my decision on any other row.
>
> Any ideas how I can do this sort of thing without simply
> bypassing the use
> of the ActionForm?
>
> Thanks in advance for any advice.
>
> BTW, the search of the struts-user list at
> http://www.mail-archive.com/struts-dev%40jakarta.apache.org/
> appears to be
> down.
> For the last several days I get an error message for any type
> of search.  I
> sent the error to webmaster@mail-archive.com as instructed by
> the error
> message
> but I haven't heard anything yet.  Does anyone else see this problem?
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>