Re: problem with logic:iterate...
msg2ajay wrote: hi, Yaa i have done mistake. I have placed my ActionForm Name insted of Confingfile form name. But the problem still there i am not able to get the form (setLableParam())value to my jsp. I have created an object in my jsp and tried to print the object, but it is returning null. and one more thing is when i tried to print in the ActionClass it is printing perfectly like below. System.out.println (ActionForm object+form.getLableParam ()); when setAttribute(),getAttribute is working fine. i am giving my code. my ActionClass: --- form.setLableParam (lableGenVect); System.out.println (ActionForm object+form.getLableParam ());// when i tried to print it is printing My FormBean: -- Vector lableParam = new Vector(); public Vector getLableParam (){ return lableParam; } public void setLableParam (Vector lables){ this.lableParam = lables; System.out.println (X32 FORM __+lables); // tried to print in form bean, its printing the vector data } my Jsp: - tr logic:iterate name=X32 id=lableParam property=lableParam tr td bean:write name=X32 property=lableParam/ /td /tr /logic:iterate /tr i have tired in so many way's but i did not find out the problem.!!! can u find out and tel me where i am doing error Ajay Well, you're iterating over X32.lableParam, but then printing X32.lableParam, which is the Vector you're iterating. Presumably you want to print the individual values of the iteration. Perhaps logic:iterate name=X32 property=lableParam id=item bean:write name=item property=someProperty/ /logic:iterate where someProperty is the name of a property on whatever type of bean is in the vector. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with logic:iterate...
X32Form is the name of your java class, not the bean. You get the name of the bean from the name attribute of your action mapping. Paul On 9/12/07, msg2ajay [EMAIL PROTECTED] wrote: hi, i am trying to get the collection object (Vector) form Action Class to my Jsp. I already set to my FormBean and i am getting an error as.. javax.servlet.jsp.JspException: Cannot find bean: X32Form in any scope my Action class is (X32Action.java): Vector lableGenVect = (Vector) xParser.xmlLableGen (Comm_vect); form.setLableParam (lableGenVect); my FormBean Class is (X32Form.java): public Vector getLableParam(){ return lableParam; } public void setLableParam(Vector lables){ this.lableParam = lables; System.out.println(X32 FORM __+lables); // I am able to set ie. i can print the values of the action class. } my jsp: - logic:iterate name=X32Form id=lableParam tr td bean:write name=X32Form property=lableParam/ /td /tr /logic:iterate thanQ, Ajay -- View this message in context: http://www.nabble.com/problem-with-%3Clogic%3Aiterate...-tf4433312.html#a12647969 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with logic:iterate...
hi, Yaa i have done mistake. I have placed my ActionForm Name insted of Confingfile form name. But the problem still there i am not able to get the form (setLableParam())value to my jsp. I have created an object in my jsp and tried to print the object, but it is returning null. and one more thing is when i tried to print in the ActionClass it is printing perfectly like below. System.out.println (ActionForm object+form.getLableParam ()); when setAttribute(),getAttribute is working fine. i am giving my code. my ActionClass: --- form.setLableParam (lableGenVect); System.out.println (ActionForm object+form.getLableParam ());// when i tried to print it is printing My FormBean: -- Vector lableParam = new Vector(); public Vector getLableParam (){ return lableParam; } public void setLableParam (Vector lables){ this.lableParam = lables; System.out.println (X32 FORM __+lables); // tried to print in form bean, its printing the vector data } my Jsp: - tr logic:iterate name=X32 id=lableParam property=lableParam tr td bean:write name=X32 property=lableParam/ /td /tr /logic:iterate /tr i have tired in so many way's but i did not find out the problem.!!! can u find out and tel me where i am doing error Ajay -- View this message in context: http://www.nabble.com/problem-with-%3Clogic%3Aiterate...-tf4433312.html#a12667667 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
problem with logic:iterate...
hi, i am trying to get the collection object (Vector) form Action Class to my Jsp. I already set to my FormBean and i am getting an error as.. javax.servlet.jsp.JspException: Cannot find bean: X32Form in any scope my Action class is (X32Action.java): Vector lableGenVect = (Vector) xParser.xmlLableGen (Comm_vect); form.setLableParam (lableGenVect); my FormBean Class is (X32Form.java): public Vector getLableParam(){ return lableParam; } public void setLableParam(Vector lables){ this.lableParam = lables; System.out.println(X32 FORM __+lables); // I am able to set ie. i can print the values of the action class. } my jsp: - logic:iterate name=X32Form id=lableParam tr td bean:write name=X32Form property=lableParam/ /td /tr /logic:iterate thanQ, Ajay -- View this message in context: http://www.nabble.com/problem-with-%3Clogic%3Aiterate...-tf4433312.html#a12647969 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with logic:iterate and List of Strings
I actually found the page you were mentioning before. But that doesn't resolve my problem: In Dynamic Indexes for Indexed Properties there is an example for using a text-field to alter a String value: html:text name=stringbean property='%= labelValue[ + ctr + ].label %' / Looks very nice, but the textfield accesses the getter and setter of the LabelValueBean that is returned from the StrinBean. My Bean just returns the the String-object that has actually no getter and setter for it's value. I hope that could clarify myy problem ;) Greetings, Florian Zitat von Rahul Akolkar [EMAIL PROTECTED]: [Zitattext verstecken] On 6/13/06, Florian Barth [EMAIL PROTECTED] wrote: Hi folks! I'm having a little problem with a jsp. My FormBean has a List of Strings as value. Now I would like to iterate over the elements of that list, creating a text-field for every element the list contains. At the moment I can online write out the elements using this code-snippet: logic:iterate name=FormBean property=stringList id=str bean:write name=str / /logig:iterate Just putting in html:text name=str property=fooBar doesn't work, because the str-String-Object doesn't have getter or setter for it's value, so I didn't find an substitute for fooBar that works. I pretty sure that there is an easier way than writing a wrapper for String with getter and setter. snip/ http://struts.apache.org/struts-action/struts-taglib/indexedprops.html -Rahul I searched the Mailing-List and googled around a bit, but didn't find something useful. Hope you can help me, Thank you very much, Regards, Florian - 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: Problem with logic:iterate and List of Strings
Florian Barth wrote: Looks very nice, but the textfield accesses the getter and setter of the LabelValueBean that is returned from the StrinBean. My Bean just returns the the String-object that has actually no getter and setter for it's value. Let me get this straight: you're iterating over a list of strings and you want to create a textbox for each one, but they're not linked to an ActionForm bean? c:forEach items=${listOstrings} var=s input type=text name=${s} /c:forEach If they're not fields in an ActionForm I'm not sure how you're going to be able to use the Struts form beans. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with logic:iterate and List of Strings
The list of strings is actually part of an ActionForm. On load of display I kinda like to decompose the list to a bunch of text-fields, that are recomposed to a list of string on submit c:forEach items=${listOstrings} var=s input type=text name=${s} /c:forEach I'll try this, maybe the value of the String could be added by value = ${s}, right? Thank you Dave Newton schrieb: Florian Barth wrote: Looks very nice, but the textfield accesses the getter and setter of the LabelValueBean that is returned from the StrinBean. My Bean just returns the the String-object that has actually no getter and setter for it's value. Let me get this straight: you're iterating over a list of strings and you want to create a textbox for each one, but they're not linked to an ActionForm bean? c:forEach items=${listOstrings} var=s input type=text name=${s} /c:forEach If they're not fields in an ActionForm I'm not sure how you're going to be able to use the Struts form beans. Dave - 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: Problem with logic:iterate and List of Strings
I tried to do it with your piece of code, but that didn't quite work I think one solution would be to write a StringWrapper with a String-Value and the according getter/setter (e.g. getVal, setVal) and fill the list with this StringWrappers instead of Strings, so html:text name=stringWrapper value = val / will work But I really dislik changing my data-structure because of some gui-problems Ideas anyone ? ;) Florian Barth schrieb: The list of strings is actually part of an ActionForm. On load of display I kinda like to decompose the list to a bunch of text-fields, that are recomposed to a list of string on submit c:forEach items=${listOstrings} var=s input type=text name=${s} /c:forEach I'll try this, maybe the value of the String could be added by value = ${s}, right? Thank you Dave Newton schrieb: Florian Barth wrote: Looks very nice, but the textfield accesses the getter and setter of the LabelValueBean that is returned from the StrinBean. My Bean just returns the the String-object that has actually no getter and setter for it's value. Let me get this straight: you're iterating over a list of strings and you want to create a textbox for each one, but they're not linked to an ActionForm bean? c:forEach items=${listOstrings} var=s input type=text name=${s} /c:forEach If they're not fields in an ActionForm I'm not sure how you're going to be able to use the Struts form beans. Dave - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem with logic:iterate and List of Strings
Hi folks! I'm having a little problem with a jsp. My FormBean has a List of Strings as value. Now I would like to iterate over the elements of that list, creating a text-field for every element the list contains. At the moment I can online write out the elements using this code-snippet: logic:iterate name=FormBean property=stringList id=str bean:write name=str / /logig:iterate Just putting in html:text name=str property=fooBar doesn't work, because the str-String-Object doesn't have getter or setter for it's value, so I didn't find an substitute for fooBar that works. I pretty sure that there is an easier way than writing a wrapper for String with getter and setter. I searched the Mailing-List and googled around a bit, but didn't find something useful. Hope you can help me, Thank you very much, Regards, Florian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with logic:iterate and List of Strings
On 6/13/06, Florian Barth [EMAIL PROTECTED] wrote: Hi folks! I'm having a little problem with a jsp. My FormBean has a List of Strings as value. Now I would like to iterate over the elements of that list, creating a text-field for every element the list contains. At the moment I can online write out the elements using this code-snippet: logic:iterate name=FormBean property=stringList id=str bean:write name=str / /logig:iterate Just putting in html:text name=str property=fooBar doesn't work, because the str-String-Object doesn't have getter or setter for it's value, so I didn't find an substitute for fooBar that works. I pretty sure that there is an easier way than writing a wrapper for String with getter and setter. snip/ http://struts.apache.org/struts-action/struts-taglib/indexedprops.html -Rahul I searched the Mailing-List and googled around a bit, but didn't find something useful. Hope you can help me, Thank you very much, Regards, Florian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with logic:iterate (and nested:iterate) and indexed form items - Help required
Murray, Many thanks - I had totally missed indexId. This makes it so easy! Mike Murray Collingwood wrote: Hi Mike Thats easy. Outer loop needs to specify the indexId parameter as in: logic:iterate name=applicationForm property=familymembers id=familymmber type=application.FamilyMember indexId=memberIndex Then you can use whatever inner loop (or loops) you want. logic:iterate something else Inside here you can refer to the 'memberIndex' as in: html:text name=familymembers[${memberIndex}].forename HTH Cheers mc On 29 Oct 2005 at 15:29, Mike Manley wrote: Thanks for that - but I think I've not explained my problem properly. The problem is that the bean containing the data is NOT the one in the inner loop but the bean iterated through in the outer loop: logic:iterate name=applicationForm property=familymembers id=familymmber type=application.FamilyMember I want to be able to access as from within the inner loop. familymembers[0].surname, familymembers[0].forename, familymembers[1].surname, etc. The reason for this is that the form needs to show and allow editing of different data depending on who is accessing it. Yeah, I know it makes things complicated but it's what THEY want. The inner iterate is around a form configuration bean which describes the data which should be displayed: logic:iterate name=applicationForm property=familyItems id=formItem type=utils.InputItem InputItem has fields which describe the type of input field to be used and whether it is displayed, readonly, mandatory, etc. i.e. inputitem is an array with entries something like - there are other fields to hold any option lists for select items, etc. but those aren't really relevant to this problem. inputitem[0] property=surname readonly=false size=30 type=text mandatory=true inputitem[1] property=forename readonly=false size=30 type=text mandatory=true and I want to end up with html like this. !-- First Row -- input type=text name=familymembers[0].forename value= input type=text name=familymembers[0].surname value= !-- 2nd row -- input type=text name=familymembers[1].forename value= input type=text name=familymembers[1].surname value= but because the iterator count is picked up from the inner loop - I end up with !-- First Row -- input type=text name=familymembers[0].forename value= input type=text name=familymembers[1].surname value= !-- 2nd row -- input type=text name=familymembers[0].forename value= input type=text name=familymembers[1].surname value= !-- 3rd row -- input type=text name=familymembers[0].forename value= input type=text name=familymembers[1].surname value= I've done this successfully using a similar technique when there is a single data item to be edited but this form needs to be able to edit multiple rows at once and I'm hitting a problem with the iterator. I guess what I really need is a way to iterate round the inner loop without the counter used for indexing being increased. Again, thanks for any help anyone can give. Mike Murray Collingwood wrote: Hi Mike Maybe I'm simplifying it somewhat and I'm not sure of your form-bean structure, however the outer loop should loop through 'familymembers' as it is looping it should set a form-bean for the inner loop identifying a 'familymember'. I also like to add the type here - helps my inline documentation. So, outer loop should be: logic:iterate name=applicationForm property=familymembers id=familymember type=controller.form.FamilyMemberForm Then we can add the inner loop in a similar manner, referencing the 'familymember' defined in the outerloop: logic:iterate name=familymember id=familyitem type=controller.form.FamilyItemForm Finally we can then display the input box for these items: html:text name=familyItem property=dataProperty size=${familyItem.size} readonly=${familyItem.readonly} Maybe this is too simplistic, sorry if I've missed the point somewhere. Kind regards mc On 28 Oct 2005 at 14:01, Mike Manley wrote: Hi, I have a problem trying to create a multi row edit form which has to be able to dynamically decide which columns should be displayed for edit. My jsp uses the code below. logic:iterate name=applicationForm property=familymembers id=familymembers tr logic:iterate name=applicationForm property=familyItems id=formItem td logic:notEmpty name=formItem % InputItem inputItem = (InputItem)formItem; % logic:equal name=formItem property=type value=text html:text size=%= inputItem.getSize() % readonly=%= inputItem.isReadonly()% name=familymembers property=%= inputItem.getDataProperty() % indexed=true/ /logic:equal /td /logic:iterate /td /logic:iterate The outer iterate is the bean holding the data - in this case a list of family members -
Re: Problem with logic:iterate (and nested:iterate) and indexed form items - Help required
Thanks for that - but I think I've not explained my problem properly. The problem is that the bean containing the data is NOT the one in the inner loop but the bean iterated through in the outer loop: logic:iterate name=applicationForm property=familymembers id=familymmber type=application.FamilyMember I want to be able to access as from within the inner loop. familymembers[0].surname, familymembers[0].forename, familymembers[1].surname, etc. The reason for this is that the form needs to show and allow editing of different data depending on who is accessing it. Yeah, I know it makes things complicated but it's what THEY want. The inner iterate is around a form configuration bean which describes the data which should be displayed: logic:iterate name=applicationForm property=familyItems id=formItem type=utils.InputItem InputItem has fields which describe the type of input field to be used and whether it is displayed, readonly, mandatory, etc. i.e. inputitem is an array with entries something like - there are other fields to hold any option lists for select items, etc. but those aren't really relevant to this problem. inputitem[0] property=surname readonly=false size=30 type=text mandatory=true inputitem[1] property=forename readonly=false size=30 type=text mandatory=true and I want to end up with html like this. !-- First Row -- input type=text name=familymembers[0].forename value= input type=text name=familymembers[0].surname value= !-- 2nd row -- input type=text name=familymembers[1].forename value= input type=text name=familymembers[1].surname value= but because the iterator count is picked up from the inner loop - I end up with !-- First Row -- input type=text name=familymembers[0].forename value= input type=text name=familymembers[1].surname value= !-- 2nd row -- input type=text name=familymembers[0].forename value= input type=text name=familymembers[1].surname value= !-- 3rd row -- input type=text name=familymembers[0].forename value= input type=text name=familymembers[1].surname value= I've done this successfully using a similar technique when there is a single data item to be edited but this form needs to be able to edit multiple rows at once and I'm hitting a problem with the iterator. I guess what I really need is a way to iterate round the inner loop without the counter used for indexing being increased. Again, thanks for any help anyone can give. Mike Murray Collingwood wrote: Hi Mike Maybe I'm simplifying it somewhat and I'm not sure of your form-bean structure, however the outer loop should loop through 'familymembers' as it is looping it should set a form-bean for the inner loop identifying a 'familymember'. I also like to add the type here - helps my inline documentation. So, outer loop should be: logic:iterate name=applicationForm property=familymembers id=familymember type=controller.form.FamilyMemberForm Then we can add the inner loop in a similar manner, referencing the 'familymember' defined in the outerloop: logic:iterate name=familymember id=familyitem type=controller.form.FamilyItemForm Finally we can then display the input box for these items: html:text name=familyItem property=dataProperty size=${familyItem.size} readonly=${familyItem.readonly} Maybe this is too simplistic, sorry if I've missed the point somewhere. Kind regards mc On 28 Oct 2005 at 14:01, Mike Manley wrote: Hi, I have a problem trying to create a multi row edit form which has to be able to dynamically decide which columns should be displayed for edit. My jsp uses the code below. logic:iterate name=applicationForm property=familymembers id=familymembers tr logic:iterate name=applicationForm property=familyItems id=formItem td logic:notEmpty name=formItem % InputItem inputItem = (InputItem)formItem; % logic:equal name=formItem property=type value=text html:text size=%= inputItem.getSize() % readonly=%= inputItem.isReadonly()% name=familymembers property=%= inputItem.getDataProperty() % indexed=true/ /logic:equal /td /logic:iterate /td /logic:iterate The outer iterate is the bean holding the data - in this case a list of family members - name, gender, date of birth. The inner iterate is the list of fields to be displayed for each, My problems is that when this is rendered as html - the index values generated use the index of the inner iterate not the outer one - so I get tr td input type=text name=familymembers[0].forename value= /td td input type=text name=familymembers[1].surname value= /td /tr tr td input type=text name=familymembers[0].forename value= /td td input type=text name=familymembers[1].surname value= /td /tr whereas what I want is
Re: Problem with logic:iterate (and nested:iterate) and indexed form items - Help required
Hi Mike Thats easy. Outer loop needs to specify the indexId parameter as in: logic:iterate name=applicationForm property=familymembers id=familymmber type=application.FamilyMember indexId=memberIndex Then you can use whatever inner loop (or loops) you want. logic:iterate something else Inside here you can refer to the 'memberIndex' as in: html:text name=familymembers[${memberIndex}].forename HTH Cheers mc On 29 Oct 2005 at 15:29, Mike Manley wrote: Thanks for that - but I think I've not explained my problem properly. The problem is that the bean containing the data is NOT the one in the inner loop but the bean iterated through in the outer loop: logic:iterate name=applicationForm property=familymembers id=familymmber type=application.FamilyMember I want to be able to access as from within the inner loop. familymembers[0].surname, familymembers[0].forename, familymembers[1].surname, etc. The reason for this is that the form needs to show and allow editing of different data depending on who is accessing it. Yeah, I know it makes things complicated but it's what THEY want. The inner iterate is around a form configuration bean which describes the data which should be displayed: logic:iterate name=applicationForm property=familyItems id=formItem type=utils.InputItem InputItem has fields which describe the type of input field to be used and whether it is displayed, readonly, mandatory, etc. i.e. inputitem is an array with entries something like - there are other fields to hold any option lists for select items, etc. but those aren't really relevant to this problem. inputitem[0] property=surname readonly=false size=30 type=text mandatory=true inputitem[1] property=forename readonly=false size=30 type=text mandatory=true and I want to end up with html like this. !-- First Row -- input type=text name=familymembers[0].forename value= input type=text name=familymembers[0].surname value= !-- 2nd row -- input type=text name=familymembers[1].forename value= input type=text name=familymembers[1].surname value= but because the iterator count is picked up from the inner loop - I end up with !-- First Row -- input type=text name=familymembers[0].forename value= input type=text name=familymembers[1].surname value= !-- 2nd row -- input type=text name=familymembers[0].forename value= input type=text name=familymembers[1].surname value= !-- 3rd row -- input type=text name=familymembers[0].forename value= input type=text name=familymembers[1].surname value= I've done this successfully using a similar technique when there is a single data item to be edited but this form needs to be able to edit multiple rows at once and I'm hitting a problem with the iterator. I guess what I really need is a way to iterate round the inner loop without the counter used for indexing being increased. Again, thanks for any help anyone can give. Mike Murray Collingwood wrote: Hi Mike Maybe I'm simplifying it somewhat and I'm not sure of your form-bean structure, however the outer loop should loop through 'familymembers' as it is looping it should set a form-bean for the inner loop identifying a 'familymember'. I also like to add the type here - helps my inline documentation. So, outer loop should be: logic:iterate name=applicationForm property=familymembers id=familymember type=controller.form.FamilyMemberForm Then we can add the inner loop in a similar manner, referencing the 'familymember' defined in the outerloop: logic:iterate name=familymember id=familyitem type=controller.form.FamilyItemForm Finally we can then display the input box for these items: html:text name=familyItem property=dataProperty size=${familyItem.size} readonly=${familyItem.readonly} Maybe this is too simplistic, sorry if I've missed the point somewhere. Kind regards mc On 28 Oct 2005 at 14:01, Mike Manley wrote: Hi, I have a problem trying to create a multi row edit form which has to be able to dynamically decide which columns should be displayed for edit. My jsp uses the code below. logic:iterate name=applicationForm property=familymembers id=familymembers tr logic:iterate name=applicationForm property=familyItems id=formItem td logic:notEmpty name=formItem % InputItem inputItem = (InputItem)formItem; % logic:equal name=formItem property=type value=text html:text size=%= inputItem.getSize() % readonly=%= inputItem.isReadonly()% name=familymembers property=%= inputItem.getDataProperty() % indexed=true/ /logic:equal /td /logic:iterate /td /logic:iterate The outer iterate is the bean holding the data
Problem with logic:iterate (and nested:iterate) and indexed form items - Help required
Hi, I have a problem trying to create a multi row edit form which has to be able to dynamically decide which columns should be displayed for edit. My jsp uses the code below. logic:iterate name=applicationForm property=familymembers id=familymembers tr logic:iterate name=applicationForm property=familyItems id=formItem td logic:notEmpty name=formItem % InputItem inputItem = (InputItem)formItem; % logic:equal name=formItem property=type value=text html:text size=%= inputItem.getSize() % readonly=%= inputItem.isReadonly()% name=familymembers property=%= inputItem.getDataProperty() % indexed=true/ /logic:equal /td /logic:iterate /td /logic:iterate The outer iterate is the bean holding the data - in this case a list of family members - name, gender, date of birth. The inner iterate is the list of fields to be displayed for each, My problems is that when this is rendered as html - the index values generated use the index of the inner iterate not the outer one - so I get tr td input type=text name=familymembers[0].forename value= /td td input type=text name=familymembers[1].surname value= /td /tr tr td input type=text name=familymembers[0].forename value= /td td input type=text name=familymembers[1].surname value= /td /tr whereas what I want is tr td input type=text name=familymembers[0].forename value= /td td input type=text name=familymembers[0].surname value= /td /tr tr td input type=text name=familymembers[0].forename value= /td td input type=text name=familymembers[1].surname value= /td /tr I have also tried using nested:iterate as well - in which case I get tr td input type=text name=applicationForm[0].familymembers[0].forename value= /td td input type=text name=applicationForm[1].familymembers[0].surname value= /td /tr tr td input type=text name=applicationForm[0].familymembers[1].forename value= /td td input type=text name=applicationForm[1].familymembers[1].surname value= /td /tr so the familymembers index is now correct but I have an additionally applicationForm[0] that I don't need. Basically what I want to achieve is that the inner loop is ignored for the purposes of generating the indexing for the html output - but can't figure out to achieve that without writing my own tag. Can anyone help? Thanks Mike Manley - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with logic:iterate (and nested:iterate) and indexed form items - Help required
Hi Mike Maybe I'm simplifying it somewhat and I'm not sure of your form-bean structure, however the outer loop should loop through 'familymembers' as it is looping it should set a form-bean for the inner loop identifying a 'familymember'. I also like to add the type here - helps my inline documentation. So, outer loop should be: logic:iterate name=applicationForm property=familymembers id=familymember type=controller.form.FamilyMemberForm Then we can add the inner loop in a similar manner, referencing the 'familymember' defined in the outerloop: logic:iterate name=familymember id=familyitem type=controller.form.FamilyItemForm Finally we can then display the input box for these items: html:text name=familyItem property=dataProperty size=${familyItem.size} readonly=${familyItem.readonly} Maybe this is too simplistic, sorry if I've missed the point somewhere. Kind regards mc On 28 Oct 2005 at 14:01, Mike Manley wrote: Hi, I have a problem trying to create a multi row edit form which has to be able to dynamically decide which columns should be displayed for edit. My jsp uses the code below. logic:iterate name=applicationForm property=familymembers id=familymembers tr logic:iterate name=applicationForm property=familyItems id=formItem td logic:notEmpty name=formItem % InputItem inputItem = (InputItem)formItem; % logic:equal name=formItem property=type value=text html:text size=%= inputItem.getSize() % readonly=%= inputItem.isReadonly()% name=familymembers property=%= inputItem.getDataProperty() % indexed=true/ /logic:equal /td /logic:iterate /td /logic:iterate The outer iterate is the bean holding the data - in this case a list of family members - name, gender, date of birth. The inner iterate is the list of fields to be displayed for each, My problems is that when this is rendered as html - the index values generated use the index of the inner iterate not the outer one - so I get tr td input type=text name=familymembers[0].forename value= /td td input type=text name=familymembers[1].surname value= /td /tr tr td input type=text name=familymembers[0].forename value= /td td input type=text name=familymembers[1].surname value= /td /tr whereas what I want is tr td input type=text name=familymembers[0].forename value= /td td input type=text name=familymembers[0].surname value= /td /tr tr td input type=text name=familymembers[0].forename value= /td td input type=text name=familymembers[1].surname value= /td /tr I have also tried using nested:iterate as well - in which case I get tr td input type=text name=applicationForm[0].familymembers[0].forename value= /td td input type=text name=applicationForm[1].familymembers[0].surname value= /td /tr tr td input type=text name=applicationForm[0].familymembers[1].forename value= /td td input type=text name=applicationForm[1].familymembers[1].surname value= /td /tr so the familymembers index is now correct but I have an additionally applicationForm[0] that I don't need. Basically what I want to achieve is that the inner loop is ignored for the purposes of generating the indexing for the html output - but can't figure out to achieve that without writing my own tag. Can anyone help? Thanks Mike Manley - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 27/10/2005 FOCUS Computing - web design Mob: 0415 24 26 24 [EMAIL PROTECTED] http://www.focus-computing.com.au -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 27/10/2005 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem with logic:iterate Tag
Any guess whats happening wrong here?, the output is as follows 4thCol 4thCol 4thCol 4thCol 4thCol 4thCol 4thCol 4thCol But the correct output should be as follows 1stCol 2ndCol 3rdCol 4thCol 1stCol 2ndCol 3rdCol 4thCol Deepak -Original Message- From: Deepak Srivatava [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 08, 2005 6:57 PM To: user@struts.apache.org Subject: Problem with logic:iterate Tag I am populating following simple List in action class and putting that in form class. private List getSystemTableList(ConfWizardBean confwizbean, HttpSession session){ ArrayList outerList = new ArrayList(); for (int i = 0; i 2; i++) { ArrayList innerList = new ArrayList(); innerList.add(0,Ist Column); innerList.add(1,2nd Column); innerList.add(2,3rd column); innerList.add(3,4th Column); outerList.add(innerList); } return outerList; } relevant JSP code is as follows %-- Iterate through the system list --% bean:define id=systemList name=MyForm property=systemTableList/ logic:present name=systemList logic:notEmpty name=systemList logic:iterate id=innerList name=systemList indexId=index logic:iterate id=1stCol name=innerList offset=0/ logic:iterate id=2ndCol name=innerList offset=1/ logic:iterate id=3rdCol name=innerList offset=2/ logic:iterate id=4thCol name=innerList offset=3/ TD align=center class=bodyText nowrapbean:write name=1stCol //td TD align=center valign=middlebean:write name=2ndCol//td TD align=center valign=middlebean:write name=3rdCol //td TD align=center valign=middlebean:write name=4thCol//td /logic:iterate /logic:notEmpty /logic:present I am trying to print the above list in Jsp page but it always print the value 4th Column in all the four columns of HTML. Somehow it always uses the offset=3. What I am doing wrong here?. Deepak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem with logic:iterate Tag
I am populating following simple List in action class and putting that in form class. private List getSystemTableList(ConfWizardBean confwizbean, HttpSession session){ ArrayList outerList = new ArrayList(); for (int i = 0; i 2; i++) { ArrayList innerList = new ArrayList(); innerList.add(0,Ist Column); innerList.add(1,2nd Column); innerList.add(2,3rd column); innerList.add(3,4th Column); outerList.add(innerList); } return outerList; } relevant JSP code is as follows %-- Iterate through the system list --% bean:define id=systemList name=MyForm property=systemTableList/ logic:present name=systemList logic:notEmpty name=systemList logic:iterate id=innerList name=systemList indexId=index logic:iterate id=1stCol name=innerList offset=0/ logic:iterate id=2ndCol name=innerList offset=1/ logic:iterate id=3rdCol name=innerList offset=2/ logic:iterate id=4thCol name=innerList offset=3/ TD align=center class=bodyText nowrapbean:write name=1stCol //td TD align=center valign=middlebean:write name=2ndCol//td TD align=center valign=middlebean:write name=3rdCol //td TD align=center valign=middlebean:write name=4thCol//td /logic:iterate /logic:notEmpty /logic:present I am trying to print the above list in Jsp page but it always print the value 4th Column in all the four columns of HTML. Somehow it always uses the offset=3. What I am doing wrong here?. Deepak
Re: problem with logic:iterate
Hi, U can do - logic:iterate collection=%= vec% id=vecRow indexId=index logic:equal ... //do some thing /logic:equal /logic:iterate --- Kade Jeevan Kumar [EMAIL PROTECTED] wrote: Hi i have for(int i=0; i vec.size(); i++) { if(i=5) { // do some thing } } how can i use the same code in logice:iterate Help me out with example. -Thnx in Advance Jeevan __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
problem with logic:iterate
Hi i have for(int i=0; i vec.size(); i++) { if(i=5) { // do some thing } } how can i use the same code in logice:iterate Help me out with example. -Thnx in Advance Jeevan __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
problem with logic:iterate
hi folks, I am trying to iterate a through a Vector of object of class Project where project has getter and setter getDescription(),setDescription(),etc In the jsp page I first created bean of name bar. Vector v=new Vector(); Project p1=new Project(); p1.setName(project1); p1.setDescription(des); pageContext.setAttribute(bar,v,PageContext.PAGE_SCOPE); then trying to iterate over bar logic:iterate id=element name=bar bean:write name=element/ /logic:iterate __ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with logic:iterate
I think this is what you are looking for logic:iterate name=myVector id=myProject indexId=i bean:define id=mydescription name=myProject property=description / bean:write name=mydescription/ /logic:iterate -Eric [EMAIL PROTECTED] 3/2/2005 12:09:49 PM hi folks, I am trying to iterate a through a Vector of object of class Project where project has getter and setter getDescription(),setDescription(),etc In the jsp page I first created bean of name bar. Vector v=new Vector(); Project p1=new Project(); p1.setName(project1); p1.setDescription(des); pageContext.setAttribute(bar,v,PageContext.PAGE_SCOPE); then trying to iterate over bar logic:iterate id=element name=bar /logic:iterate __ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ - 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: Resolved problem with logic:iterate
Ok it's a trivial mistake, didn't actually put anything in the Vector. --- Jonathan M Z [EMAIL PROTECTED] wrote: hi folks, I am trying to iterate a through a Vector of object of class Project where project has getter and setter getDescription(),setDescription(),etc In the jsp page I first created bean of name bar. Vector v=new Vector(); Project p1=new Project(); p1.setName(project1); p1.setDescription(des); pageContext.setAttribute(bar,v,PageContext.PAGE_SCOPE); then trying to iterate over bar logic:iterate id=element name=bar bean:write name=element/ /logic:iterate __ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with logic:iterate
thanks I am running into a related problem with radio buttons: logic:iterate id=element name=bar html:radio idName=element value=name property=pName /html:radio /logic:iterate when rendered it says: [ServletException in:/calc/ProjectManagerMain.jsp] Cannot find bean under name org.apache.struts.taglib.html.BEAN' What's wrong? thanks --- Eric Lemle [EMAIL PROTECTED] wrote: I think this is what you are looking for logic:iterate name=myVector id=myProject indexId=i bean:define id=mydescription name=myProject property=description / bean:write name=mydescription/ /logic:iterate -Eric [EMAIL PROTECTED] 3/2/2005 12:09:49 PM hi folks, I am trying to iterate a through a Vector of object of class Project where project has getter and setter getDescription(),setDescription(),etc In the jsp page I first created bean of name bar. Vector v=new Vector(); Project p1=new Project(); p1.setName(project1); p1.setDescription(des); pageContext.setAttribute(bar,v,PageContext.PAGE_SCOPE); then trying to iterate over bar logic:iterate id=element name=bar /logic:iterate __ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ - 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] __ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with logic:iterate
Is bar in the session? [EMAIL PROTECTED] 3/2/2005 12:45:03 PM thanks I am running into a related problem with radio buttons: logic:iterate id=element name=bar html:radio idName=element value=name property=pName /html:radio /logic:iterate when rendered it says: [ServletException in:/calc/ProjectManagerMain.jsp] Cannot find bean under name org.apache.struts.taglib.html.BEAN' What's wrong? thanks --- Eric Lemle [EMAIL PROTECTED] wrote: I think this is what you are looking for logic:iterate name=myVector id=myProject indexId=i bean:define id=mydescription name=myProject property=description / bean:write name=mydescription/ /logic:iterate -Eric [EMAIL PROTECTED] 3/2/2005 12:09:49 PM hi folks, I am trying to iterate a through a Vector of object of class Project where project has getter and setter getDescription(),setDescription(),etc In the jsp page I first created bean of name bar. Vector v=new Vector(); Project p1=new Project(); p1.setName(project1); p1.setDescription(des); pageContext.setAttribute(bar,v,PageContext.PAGE_SCOPE); then trying to iterate over bar logic:iterate id=element name=bar /logic:iterate __ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ - 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] __ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ - 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: problem with logic:iterate
pageContext.setAttribute(bar,projects,PageContext.PAGE_SCOPE); it's an attribute in the page scope, not session, does it have to be in a session? I am only using it for the current page... --- Eric Lemle [EMAIL PROTECTED] wrote: Is bar in the session? [EMAIL PROTECTED] 3/2/2005 12:45:03 PM thanks I am running into a related problem with radio buttons: logic:iterate id=element name=bar html:radio idName=element value=name property=pName /html:radio /logic:iterate when rendered it says: [ServletException in:/calc/ProjectManagerMain.jsp] Cannot find bean under name org.apache.struts.taglib.html.BEAN' What's wrong? thanks --- Eric Lemle [EMAIL PROTECTED] wrote: I think this is what you are looking for logic:iterate name=myVector id=myProject indexId=i bean:define id=mydescription name=myProject property=description / bean:write name=mydescription/ /logic:iterate -Eric [EMAIL PROTECTED] 3/2/2005 12:09:49 PM hi folks, I am trying to iterate a through a Vector of object of class Project where project has getter and setter getDescription(),setDescription(),etc In the jsp page I first created bean of name bar. Vector v=new Vector(); Project p1=new Project(); p1.setName(project1); p1.setDescription(des); pageContext.setAttribute(bar,v,PageContext.PAGE_SCOPE); then trying to iterate over bar logic:iterate id=element name=bar /logic:iterate __ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ - 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] __ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ - 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] __ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem with logic:iterate and HashMap
Hello all, I have a problem with the logic:iterate tag. I need to iterate over a HashMap which stores wrapper objects(which include the actual data). A wrapper class has for example one attribute velocity. As far as I know the only way to access such a HashMap is this method: logic:iterate id=element name=hashMap indexId=index bean:write name=element property=key / bean:write name=element property=value / /logic:iterate Is there any way to get the velocity attribute out of the wrapper class? Regards, Peter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with logic:iterate and HashMap
logic:iterate id=element name=hashMap indexId=index bean:define id = vObj name=element property=value / bean:write name = vObj property = velocity / /logic:iterate Peter Neu wrote: Hello all, I have a problem with the logic:iterate tag. I need to iterate over a HashMap which stores wrapper objects(which include the actual data). A wrapper class has for example one attribute velocity. As far as I know the only way to access such a HashMap is this method: logic:iterate id=element name=hashMap indexId=index bean:write name=element property=key / bean:write name=element property=value / /logic:iterate Is there any way to get the velocity attribute out of the wrapper class? Regards, Peter - 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]
Problem with logic:iterate with DynaValidatorForm in Struts1.1
Hi, I am unable to iterate an ArrayList while using struts1.1 with DynaValidatorForm. Has any one tried it? I am getting the following error in WSAD 5.1... [04/11/17 14:31:41:915 IST] 54f64cef WebGroup E SRVE0026E: [Servlet Error]-[Cannot find bean ProductLines in any scope]: javax.servlet.jsp.JspException: Cannot find bean ProductLines in any scope Note: I have seen some examples using Form Bean classes but here I don't have any Form Bean since its a DynaValidatorForm thanks in advance. -selva. ___ Win a castle for NYE with your mates and Yahoo! Messenger http://uk.messenger.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]