RE: how to pass more than one value when a multibox ischecked?
Can you use indexed elements? -Original Message- From: Sashi Ravipati [mailto:[EMAIL PROTECTED] Sent: Friday, June 13, 2003 2:36 PM To: [EMAIL PROTECTED] Subject: RE: how to pass more than one value when a multibox ischecked? This is an interesting paper which talks abt iteration, look at pages 8,9,10,11 it may give u some idea http://stealthis.athensgroup.com/presentations/Model_Layer_Framework/Struts_ Whitepaper.pdf >>> [EMAIL PROTECTED] 06/13/03 10:30AM >>> Hi Sashi, Thanks very much for your answer. But my jsp page is a little different from yours, I have multibox and text fields in my jsp page: My jsp page is as followings: project Title: In my form: private String[] name = null; public String[] getName() { return name; } public void setName(String[] name) { this.name = name; } private String[] selectedItems = {}; public String[] getSelectedItems() { return this.selectedItems; } public void setSelectedItems(String[] selectedItems) { this.selectedItems = selectedItems; } In my action: String selectedItems[]=((MyForm)form).getSelectedItems(); String nameArray[]=((MyForm)form).getName(); Long actId=null; for(int i=0;imailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 2:10 PM To: [EMAIL PROTECTED] Subject: Re: how to pass more than one value when a multibox ischecked? I used the following code for two text boxes, u can change it to your need I am also learning so bear with my suggestions. 1. Action form code: private ArrayList personList; public void reset(ActionMapping mapping, HttpServletRequest request){ this.personList = new ArrayList(); // String num = request.getParameter("personListLength"); String num ="5"; try { if (num != null) { int len = Integer.parseInt(num); for (int i = 0; i < len; i++) this.personList.add(new PersonBean()); } }catch (NumberFormatException e) { e.printStackTrace(); } } public PersonBean getPerson(int ndx) { return (PersonBean) personList.get(ndx); } public void setPersonList(int ndx, PersonBean p) { personList.set(ndx, p); } public ArrayList getPersonList(){ return this.personList; } 2. jsp 3.PersonBean: public class PersonBean implements Serializable { String firstName; String phoneNo; public PersonBean() { super(); } public String getFirstName() { return firstName; } public void setFirstName(String newFirstName) { firstName = newFirstName; } public String getPhoneNo() { return phoneNo; } public void setPhoneNo(String newPhoneNo) { phoneNo = newPhoneNo; } } Let me know if u need any further info. Thanks >>> [EMAIL PROTECTED] 06/12/03 01:35PM >>> Hi, I am not able to pass more than one value when a multibox is checked. Is there any possible (or alternate) way to do it? I have a table in the JSP where each row contains a multibox, and a text field. When I select a checkbox and then enter some value in the text field and Submit, I need to get text field value related to this checkbox. Is there a possible way to achieve this? How can I know which checkbox connects to which text field? My jsp page is as followings: project Title: Thanks in advance! Sarah - 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]
RE: how to pass more than one value when a multibox ischecked?
This is an interesting paper which talks abt iteration, look at pages 8,9,10,11 it may give u some idea http://stealthis.athensgroup.com/presentations/Model_Layer_Framework/Struts_Whitepaper.pdf >>> [EMAIL PROTECTED] 06/13/03 10:30AM >>> Hi Sashi, Thanks very much for your answer. But my jsp page is a little different from yours, I have multibox and text fields in my jsp page: My jsp page is as followings: project Title: In my form: private String[] name = null; public String[] getName() { return name; } public void setName(String[] name) { this.name = name; } private String[] selectedItems = {}; public String[] getSelectedItems() { return this.selectedItems; } public void setSelectedItems(String[] selectedItems) { this.selectedItems = selectedItems; } In my action: String selectedItems[]=((MyForm)form).getSelectedItems(); String nameArray[]=((MyForm)form).getName(); Long actId=null; for(int i=0;imailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 2:10 PM To: [EMAIL PROTECTED] Subject: Re: how to pass more than one value when a multibox ischecked? I used the following code for two text boxes, u can change it to your need I am also learning so bear with my suggestions. 1. Action form code: private ArrayList personList; public void reset(ActionMapping mapping, HttpServletRequest request){ this.personList = new ArrayList(); // String num = request.getParameter("personListLength"); String num ="5"; try { if (num != null) { int len = Integer.parseInt(num); for (int i = 0; i < len; i++) this.personList.add(new PersonBean()); } }catch (NumberFormatException e) { e.printStackTrace(); } } public PersonBean getPerson(int ndx) { return (PersonBean) personList.get(ndx); } public void setPersonList(int ndx, PersonBean p) { personList.set(ndx, p); } public ArrayList getPersonList(){ return this.personList; } 2. jsp 3.PersonBean: public class PersonBean implements Serializable { String firstName; String phoneNo; public PersonBean() { super(); } public String getFirstName() { return firstName; } public void setFirstName(String newFirstName) { firstName = newFirstName; } public String getPhoneNo() { return phoneNo; } public void setPhoneNo(String newPhoneNo) { phoneNo = newPhoneNo; } } Let me know if u need any further info. Thanks >>> [EMAIL PROTECTED] 06/12/03 01:35PM >>> Hi, I am not able to pass more than one value when a multibox is checked. Is there any possible (or alternate) way to do it? I have a table in the JSP where each row contains a multibox, and a text field. When I select a checkbox and then enter some value in the text field and Submit, I need to get text field value related to this checkbox. Is there a possible way to achieve this? How can I know which checkbox connects to which text field? My jsp page is as followings: project Title: Thanks in advance! Sarah - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how to pass more than one value when a multibox ischecked?
Hi Sashi, Thanks very much for your answer. But my jsp page is a little different from yours, I have multibox and text fields in my jsp page: My jsp page is as followings: project Title: In my form: private String[] name = null; public String[] getName() { return name; } public void setName(String[] name) { this.name = name; } private String[] selectedItems = {}; public String[] getSelectedItems() { return this.selectedItems; } public void setSelectedItems(String[] selectedItems) { this.selectedItems = selectedItems; } In my action: String selectedItems[]=((MyForm)form).getSelectedItems(); String nameArray[]=((MyForm)form).getName(); Long actId=null; for(int i=0;imailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 2:10 PM To: [EMAIL PROTECTED] Subject: Re: how to pass more than one value when a multibox ischecked? I used the following code for two text boxes, u can change it to your need I am also learning so bear with my suggestions. 1. Action form code: private ArrayList personList; public void reset(ActionMapping mapping, HttpServletRequest request){ this.personList = new ArrayList(); // String num = request.getParameter("personListLength"); String num ="5"; try { if (num != null) { int len = Integer.parseInt(num); for (int i = 0; i < len; i++) this.personList.add(new PersonBean()); } }catch (NumberFormatException e) { e.printStackTrace(); } } public PersonBean getPerson(int ndx) { return (PersonBean) personList.get(ndx); } public void setPersonList(int ndx, PersonBean p) { personList.set(ndx, p); } public ArrayList getPersonList(){ return this.personList; } 2. jsp 3.PersonBean: public class PersonBean implements Serializable { String firstName; String phoneNo; public PersonBean() { super(); } public String getFirstName() { return firstName; } public void setFirstName(String newFirstName) { firstName = newFirstName; } public String getPhoneNo() { return phoneNo; } public void setPhoneNo(String newPhoneNo) { phoneNo = newPhoneNo; } } Let me know if u need any further info. Thanks >>> [EMAIL PROTECTED] 06/12/03 01:35PM >>> Hi, I am not able to pass more than one value when a multibox is checked. Is there any possible (or alternate) way to do it? I have a table in the JSP where each row contains a multibox, and a text field. When I select a checkbox and then enter some value in the text field and Submit, I need to get text field value related to this checkbox. Is there a possible way to achieve this? How can I know which checkbox connects to which text field? My jsp page is as followings: project Title: Thanks in advance! Sarah - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to pass more than one value when a multibox ischecked?
I used the following code for two text boxes, u can change it to your need I am also learning so bear with my suggestions. 1. Action form code: private ArrayList personList; public void reset(ActionMapping mapping, HttpServletRequest request){ this.personList = new ArrayList(); // String num = request.getParameter("personListLength"); String num ="5"; try { if (num != null) { int len = Integer.parseInt(num); for (int i = 0; i < len; i++) this.personList.add(new PersonBean()); } }catch (NumberFormatException e) { e.printStackTrace(); } } public PersonBean getPerson(int ndx) { return (PersonBean) personList.get(ndx); } public void setPersonList(int ndx, PersonBean p) { personList.set(ndx, p); } public ArrayList getPersonList(){ return this.personList; } 2. jsp 3.PersonBean: public class PersonBean implements Serializable { String firstName; String phoneNo; public PersonBean() { super(); } public String getFirstName() { return firstName; } public void setFirstName(String newFirstName) { firstName = newFirstName; } public String getPhoneNo() { return phoneNo; } public void setPhoneNo(String newPhoneNo) { phoneNo = newPhoneNo; } } Let me know if u need any further info. Thanks >>> [EMAIL PROTECTED] 06/12/03 01:35PM >>> Hi, I am not able to pass more than one value when a multibox is checked. Is there any possible (or alternate) way to do it? I have a table in the JSP where each row contains a multibox, and a text field. When I select a checkbox and then enter some value in the text field and Submit, I need to get text field value related to this checkbox. Is there a possible way to achieve this? How can I know which checkbox connects to which text field? My jsp page is as followings: project Title: Thanks in advance! Sarah