I doubt this is optimized and was done in Struts 1.1.

I used a map with each entry holding the key for given record in the database. Then all the check boxes mapped to the same map, each checkbox with a unique key.

My input form in the JSP has

<input type="checkbox" name="updateLastMtg(<%= member.getId() %>)"></td>

There is probably a way to get this to work as a Struts Tag.
The value in parens after "updateLastMtg" is what is stored in the map.

My Struts-Config has:

       <form-bean name="MembershipSetLastMeetingForm"
          type="com.jsfg.struts.form.MembershipSetLastMeetingForm">
           <form-property name="updateLastMtg" type="java.lang.String" />
           <form-property name="needMembBadge" type="java.lang.String" />
           <form-property name="meetingMonth" type="java.lang.String" />
           <form-property name="meetingDay" type="java.lang.String" />
           <form-property name="meetingYear" type="java.lang.String" />
       </form-bean>

My Form bean has:

   private final Map updateLastMtg = new HashMap();
public void setNeedMembBadge(String key, Object value) { needMembBadge.put(key, value); } public Object getNeedMembBadge(String key) { return needMembBadge.get(key); }
   public Map getMapNeedMembBadge ()    {        return needMembBadge;    }


Then the action just retrieves the map by calling getMapNeedMembBadge () and iterates through it to get the values.

Dan

----- Original Message ----- From: "Gary Feidt" <[EMAIL PROTECTED]>
To: <user@struts.apache.org>
Sent: Thursday, March 30, 2006 11:15 AM
Subject: Re: Getting list of values from checkboxes


I had used a javascript function to gather all the checked checkbox ids
on the Form into a pipe delimited string and saved that in a hidden
field.  And then pulled that apart in the Action to deside which ones I
needed to delete.  It worked for me.

Gary

chuanjiang lo wrote:
Hi all,

I have this list of students display on a table.
Every record would have a checkbox beside it.
If the checkbox is checked and user press delete, the action form is
suppose
to collect all the checkbox values and delete the records in the
database.

Can anyone enlighten me on getting the list of values from the
checkbox that
is being checked?

Appreciate any help


__________________________________

Confidentiality Statement:
This email/fax, including attachments, may include confidential and/or proprietary information and may be used only by the person or entity to which it is addressed. If the reader of this email/fax is not the intended recipient or his or her agent, the reader is hereby notified that any dissemination, distribution or copying of this email/fax is prohibited. If you have received this email/fax in error, please notify the sender by replying to this message and deleting this email or destroying this facsimile immediately.

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

Reply via email to