Jason,
Thanks very much. Works for me. I actually used multibox for this same code
before using DisplayTag. Dont know why I didnt choose to implement
that..anyways it works now.

Thanks
Gnan

-----Original Message-----
From: Jason Lea [mailto:[EMAIL PROTECTED]
Sent: Monday, October 11, 2004 7:02 PM
To: Struts Users Mailing List
Subject: Re: Checkboxes with display tag


I think you need to be using multibox for this to work.  I just did 
something similar recently and this is how I did it:

<html:form action="...my...action...here...">
<display:table ... id="row" ... >
    <display:column media="html"><html:multibox property="deleteList" 
value="${row.id}" title="delete this item"  /></display:column>
</display:table>
<html:submit value="Update" />
</html:form>

I am using JSP2.0+JSTL+EL.  Using id="row" in the display:table gives me 
a handle to each object in the list so I can get the id for each row.
Then I use ${row.id} to use as the value for the checkbox.  To do the 
same without JSTL I assume you would need to use:

<html:multibox property="deleteList"  title="delete this item"  
 ><bean:write name="row" property="id" /></html:multibox>

(but I haven't tested that)

This gets submitted to an ActionForm with these properties:

public class MyActionForm extends ActionForm {
    private String[] deleteList=new String[0];

    public String[] getDeleteList() {
        return deleteId;
    }
    public void setDeleteList(String[] fileId) {
        this.deleteId = fileId;
    }

    public void reset(ActionMapping mapping, HttpServletRequest request) {
        deleteList=new String[0];
    }

    ...

}

This gives me an array of all the id's corresponding to the ticked 
checkboxes, which I might update in a database.
Hope that gives you some clues - but probably more questions :)


Shabada, Gnaneshwer wrote:

>Hello All,
>
>I have a Struts app that I am working on and am using DisplayTag to display
>my search results. So far everything works fine. Now, I want to add a
>checkbox for each row in this Displaytag which I was able to do but unable
>to capture the checked values in my Action Class. Please verify the below
>code and let me know if you find anything missing.
>I am using <html:checkbox> and trying to pass memberId value when it is
>checked. But it takes it as literal String value.
>
>
><display:table name="sessionScope.searchResults" pagesize="5"
>defaultsort="2" defaultorder="descending" export="true"
>       
>id="memberList">
>       <display:column>
>               <html:checkbox property="deleteList" value="memberId">
>               </html:checkbox>
>       </display:column>
>       <display:column property="lastName" title="Last Name"
>sortable="true" headerClass="sortable"
>href="/registration/viewRegistration.do" 
>       
>paramId="memberName" paramProperty="memberName" />
>       <display:column property="firstName" title="First Name"
>sortable="true" headerClass="sortable" />
>       <display:column property="phone" />
>       <display:column property="email"
>href="/registration/displayEmail.do" paramId="email"
paramProperty="email"/>
>       <display:column property="occupation" />
>       <display:column property="region" />
>       <display:setProperty name="paging.banner.include_first_last"
>value="true" />
>       <display:setProperty name="paging.banner.placement" value="top" />
>                                       
>                                                       
></display:table>
>
>Please help
>
>Thanks
>Gnan
>
>======================================================================== 
>This email message is for the sole use of the intended recipient (s) and
may
>contain confidential and privileged information. Any unauthorized review,
>use, disclosure or distribution is prohibited. If you are not the intended
>recipient, please contact the sender by reply email and destroy all copies
>of the original message. To reply to our email administrator directly, send
>an email to [EMAIL PROTECTED] 
>Toys "R" Us, Inc.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>  
>


-- 
Jason Lea



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

======================================================================== 
This email message is for the sole use of the intended recipient (s) and may
contain confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all copies
of the original message. To reply to our email administrator directly, send
an email to [EMAIL PROTECTED] 
Toys "R" Us, Inc.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to