Re: How can I do this
James Can u give me some suggestion on the approach I should take, I was able to at least come to this stage after 2 weeks of struggle. Now I have some idea as how these tags work, if u can provide me alternate approach it would be great. Thanks >>> [EMAIL PROTECTED] 06/11/03 05:16PM >>> I don't recommend doing it this way, but the problem seems to be with your last select tag. The previous ones had an index, the last on does not. This won't work, as you know. -- James Mitchell Software Developer/Struts Evangelist http://www.struts-atlanta.org - Original Message - From: "Sashi Ravipati" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, June 11, 2003 8:29 AM Subject: Re: How can I do this > I am trying to build my table from the values I have in my arary. > > My JSp page code looks like this > > > >property="firstName" indexId="i" > > > <% int j = ((Integer) > pageContext.getAttribute("i")).intValue(); %> > property="<%=\"firstName[\"+j+\"]\"%>" /> > property="<%=\"firstName[\"+j+\"]\"%>" /> > > > " > > >Male >Female > > > > > > > > > >Male >Female > > > > > > Here my table is dynamic, I start with one empty row when the page loads > first, then I keep adding rows to the table and when I submit, (Lets say > b'cas of some validation errors I want to display the page again, now I > need to build the table where I am using the Logic:iterate to loop thru > my firstName array). > > My Action Form(addRateForm.java) Liiks like this > >private String[] FirstName=null; >private String[] sex=null; > public String[] getFirstName(){ > return this.FirstName; > } > > public void setFirstName(String[] newName){ > FirstName = newName; > // setRow(); > } > public String[] getSex(){ > return sex; > } > > public void setSex(String[] newSex){ > sex = newSex; > > } > > It all woks fine when I am doing the first time > > Say I added three rows and submitted, upon validation failure the page > comes back with three rows of data and a blank row. > > This is the source after it builds the page > > > > > > > > >Male >Female > > > > > > > > >Male > selected="selected">Female > > > > > > > >Male > selected="selected">Female > > > > > Now when I make some changes and resubmit > > I get Null Pointer Exception > > java.lang.NullPointerException > > void > org.apache.commons.beanutils.PropertyUtils.setIndexedProperty(java.lang.Obje ct, > java.lang.String, int, java.lang.Object) > PropertyUtils.java:1328 > > Let me know if I have to provide more info > > Also I used indexed="true" but it did not work so I tried to do the way > I showed above. > > Thanks > > >>> [EMAIL PROTECTED] 06/11/03 11:15AM >>> > Can you explain what it is you are trying to do? (in a broader scope) > > Have you looked at or used indexed fields before? > > > -- > James Mitchell > Software Developer/Struts Evangelist > http://www.struts-atlanta.org > > > - Original Message - > From: "Sashi Ravipati" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, June 11, 2003 10:41 AM > Subject: How can I do this > > > I am reading the values from an array, when I build my table I use > " /> > the above tag converts to > > > Now I also want to build a hidden value along with the text box as shown > below > > > > I tried to to this which does not work > > > How can I achieve this > > Thanks > > > > - > 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 can I do this
I don't recommend doing it this way, but the problem seems to be with your last select tag. The previous ones had an index, the last on does not. This won't work, as you know. -- James Mitchell Software Developer/Struts Evangelist http://www.struts-atlanta.org - Original Message - From: "Sashi Ravipati" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, June 11, 2003 8:29 AM Subject: Re: How can I do this > I am trying to build my table from the values I have in my arary. > > My JSp page code looks like this > > > >property="firstName" indexId="i" > > > <% int j = ((Integer) > pageContext.getAttribute("i")).intValue(); %> > property="<%=\"firstName[\"+j+\"]\"%>" /> > property="<%=\"firstName[\"+j+\"]\"%>" /> > > > " > > >Male >Female > > > > > > > > > >Male >Female > > > > > > Here my table is dynamic, I start with one empty row when the page loads > first, then I keep adding rows to the table and when I submit, (Lets say > b'cas of some validation errors I want to display the page again, now I > need to build the table where I am using the Logic:iterate to loop thru > my firstName array). > > My Action Form(addRateForm.java) Liiks like this > >private String[] FirstName=null; >private String[] sex=null; > public String[] getFirstName(){ > return this.FirstName; > } > > public void setFirstName(String[] newName){ > FirstName = newName; > // setRow(); > } > public String[] getSex(){ > return sex; > } > > public void setSex(String[] newSex){ > sex = newSex; > > } > > It all woks fine when I am doing the first time > > Say I added three rows and submitted, upon validation failure the page > comes back with three rows of data and a blank row. > > This is the source after it builds the page > > > > > > > > >Male >Female > > > > > > > > >Male > selected="selected">Female > > > > > > > >Male > selected="selected">Female > > > > > Now when I make some changes and resubmit > > I get Null Pointer Exception > > java.lang.NullPointerException > > void > org.apache.commons.beanutils.PropertyUtils.setIndexedProperty(java.lang.Obje ct, > java.lang.String, int, java.lang.Object) > PropertyUtils.java:1328 > > Let me know if I have to provide more info > > Also I used indexed="true" but it did not work so I tried to do the way > I showed above. > > Thanks > > >>> [EMAIL PROTECTED] 06/11/03 11:15AM >>> > Can you explain what it is you are trying to do? (in a broader scope) > > Have you looked at or used indexed fields before? > > > -- > James Mitchell > Software Developer/Struts Evangelist > http://www.struts-atlanta.org > > > - Original Message - > From: "Sashi Ravipati" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, June 11, 2003 10:41 AM > Subject: How can I do this > > > I am reading the values from an array, when I build my table I use > " /> > the above tag converts to > > > Now I also want to build a hidden value along with the text box as shown > below > > > > I tried to to this which does not work > > > How can I achieve this > > Thanks > > > > - > 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 can I do this
I am trying to build my table from the values I have in my arary. My JSp page code looks like this <% int j = ((Integer) pageContext.getAttribute("i")).intValue(); %> " /> " /> " > Male Female Male Female Here my table is dynamic, I start with one empty row when the page loads first, then I keep adding rows to the table and when I submit, (Lets say b'cas of some validation errors I want to display the page again, now I need to build the table where I am using the Logic:iterate to loop thru my firstName array). My Action Form(addRateForm.java) Liiks like this private String[] FirstName=null; private String[] sex=null; public String[] getFirstName(){ return this.FirstName; } public void setFirstName(String[] newName){ FirstName = newName; // setRow(); } public String[] getSex(){ return sex; } public void setSex(String[] newSex){ sex = newSex; } It all woks fine when I am doing the first time Say I added three rows and submitted, upon validation failure the page comes back with three rows of data and a blank row. This is the source after it builds the page Male Female Male Female Male Female Now when I make some changes and resubmit I get Null Pointer Exception java.lang.NullPointerException void org.apache.commons.beanutils.PropertyUtils.setIndexedProperty(java.lang.Object, java.lang.String, int, java.lang.Object) PropertyUtils.java:1328 Let me know if I have to provide more info Also I used indexed="true" but it did not work so I tried to do the way I showed above. Thanks >>> [EMAIL PROTECTED] 06/11/03 11:15AM >>> Can you explain what it is you are trying to do? (in a broader scope) Have you looked at or used indexed fields before? -- James Mitchell Software Developer/Struts Evangelist http://www.struts-atlanta.org - Original Message - From: "Sashi Ravipati" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, June 11, 2003 10:41 AM Subject: How can I do this I am reading the values from an array, when I build my table I use " /> the above tag converts to Now I also want to build a hidden value along with the text box as shown below I tried to to this which does not work How can I achieve this Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How can I do this
Can you explain what it is you are trying to do? (in a broader scope) Have you looked at or used indexed fields before? -- James Mitchell Software Developer/Struts Evangelist http://www.struts-atlanta.org - Original Message - From: "Sashi Ravipati" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, June 11, 2003 10:41 AM Subject: How can I do this I am reading the values from an array, when I build my table I use " /> the above tag converts to Now I also want to build a hidden value along with the text box as shown below I tried to to this which does not work How can I achieve this Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]