Try using the <html:multibox> tag, instead of a raw checkbox field - it was
created for just this kind of situation.

--
Martin Cooper


> -----Original Message-----
> From: Eric Chia Bok Lim [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 14, 2002 8:10 PM
> To: '[EMAIL PROTECTED]'
> Subject: FW: Checkboxes
> 
> 
> 
> 
> > if I got a list of user details, eg.
> > 
> > User Name   Country         Age     Sex     Occupation      Marital
> > Status      Checkbox
> > Tester 1            Singapore       35      Male    Lawyer
> > Married             checked
> > Tester 2            Hong Kong       25      Female  Doctor
> > Single              
> > Tester 3            China           56      Male    Retired
> > Married             checked
> > Tester 4            Malaysia        52      Male    Teacher
> > Single
> > 
> > I have checked Tester1 and Tester2 and wished to display 
> their data on the
> > next jsp. How do I achieved this? Please advise or help? 
> Any sample to
> > accomplish this?
> > 
> > [Eric Chia Bok Lim]  
> > Below are some codes I tried but reported some errors, 
> anyone knows the
> > causes?? Did I declared the attributes correctly in my 
> actionform? Or did
> > I set the attributes correctly in my jsp? 
> > 
> > <-- part of actionform -->
> > public String getName(int index) {
> >         return ((this.name)[index]);
> >     }
> >     
> >     public String[] getNameList() {
> >         return (this.name);
> >     }
> >     
> >     public void setName(int index, String name) {
> >         (this.name)[index] = name;
> >     }
> >     
> >     public String getCountry(int index) {
> >         return ((this.country)[index]);
> >     }
> >     
> >     public String[] getCountryList() {
> >         return (this.country);
> >     }
> > 
> >     public void setCountry(int index, String country) {
> >         (this.actualDateTime)[index] = actualDateTime;
> >     }
> > 
> >     public String[] getSelectedUsers() {
> >         return this.selectedUsers;
> >     }
> >     public void setSelectedUsers(String[] selectedUsers) {
> >         this.selectedUsers = selectedUsers;
> >     }
> > 
> > <-- part of jsp -->
> > <logic:iterate id="userItem" type="UserDetail" name="userForm"
> > property="userList">
> >     <input type="checkbox" name="selectedUsers" value="<%=(i+1)%>">
> >     <html:hidden property='<%="name["+i+"]"%>'
> > value="<%=userItem.getName()%>"/>
> >     <html:hidden property='<%="country["+i+"]"%>'
> > value="<%=userItem.getCountry()%>"/>
> > </logic:iterate>
> > 
> > <-- result -->
> > [15/Aug/2002 09:04:38:8] info: action:  Populating bean 
> properties from
> > this req
> > uest
> > [15/Aug/2002 09:04:38:8] info: 
> --------------------------------------
> > [15/Aug/2002 09:04:38:8] error: Exception: 
> SERVLET-execution_failed: Error
> > in ex
> > ecuting servlet action: javax.servlet.ServletException: 
> BeanUtils.populate
> > Exception Stack Trace:
> > javax.servlet.ServletException: BeanUtils.populate
> >         at
> > org.apache.struts.util.RequestUtils.populate(RequestUtils.java:774)
> >         at
> > 
> org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.
> > java:2061)
> >         at
> > 
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:156
> > 4)
> >         at
> > 
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
> > 
> >         at 
> javax.servlet.http.HttpServlet.service(HttpServlet.java:772)
> >         at 
> javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
> >         at
> > 
> com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
> >  Source)
> >         at
> > 
> com.netscape.server.servlet.servletrunner.ServletRunner.execute(Unkno
> > wn Source)
> >         at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
> >         at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
> >         at com.kivasoft.thread.ThreadBasic.run(Native Method)
> >         at java.lang.Thread.run(Thread.java:479)
> > 
> > Regards,
> > Eric
> 


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

Reply via email to