Okay, I guess that s:checkbox can do what I want but I am having trouble
getting the multiple values from the results of my checkboxes. So if I
have this ...
<s:iterator id="entry" value="myCollection">
<s:checkbox name="deleteIds" fieldValue="%{entry.id}" />
<s:checkbox name="disableIds" fieldValue="%{entry.id}" />
</s:iterator>
and in my action ...
private String[] deleteIds = new String[0];
public String[] getDeleteIds();
public void setDeleteIds(String[] deleteIds);
// same thing for disableIds
I think that should work but I'm not getting the values that I expect.
When I check only a single box it seems to submit values for both the
delete and disabled boxes, and if I check multiple boxes I only get a
single value.
I am also curious why there are 2 inputs for my checkboxes ...
<input type="checkbox" name="deleteIds"
value="0112f2dd1248f33f011248f6bcb40004"
id="globalCommentManagement_deleteIs"/>
<input type="hidden" name="__checkbox_deleteIds"
value="0112f2dd1248f33f011248f6bcb40004"/>
is String[] the right type to use for collecting the values of the
checkboxes? why am i not getting the multiple values and why are the 2
checkboxes affecting each other?
-- Allen
Allen Gilliland wrote:
actually, I did have trouble getting it to work but it doesn't really
matter because that's not really what I am looking for. That tag will
create a whole list of checkboxes, but what I really need is to create a
single checkbox which is part of a list. It's a weird situation so it
wouldn't really surprise me if s2 didn't have support for it, but I
wanted to ask.
in any case, the situation is that i am iterating over a collection and
displaying each entry in a list on the page. in that list i am
providing a couple of checkboxes which affect the status of that entry,
1 which would delete the entry, the other which would set a different
status. so my basic code is ...
<s:iterator list="myCollection">
<tr class="entry">
<td> // delete checkbox </td>
<td> // status checkbox </td>
<td> // print entry details </td>
</tr>
</s:iterator>
so i'm not really trying to print a whole list of checkboxes, i'm trying
to print a single checkbox which is based on a list. it looks like
that's what the old html:multibox tag was for, but i dunno, i didn't
write the original code that i am updating :/
-- Allen
Dave Newton wrote:
--- Allen Gilliland <[EMAIL PROTECTED]> wrote:
Is there a direct equivalent struts2 tag to the
struts1 html:multibox tag? I am looking at some old
code being migrated and i'm not sure how best to accomplish the same
thing in struts2 ...
Does <s:checkboxlist.../> not work for you?
http://struts.apache.org/2.x/docs/checkboxlist.html
d.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]