Re: Struts2 iterator tag
Hi I am also a newbie in struts 2 ,I dont know how to use this forum so replying on this thread. I also have lookalike problem with Iterator tag My JSP is s:iterator value=selllog var=selllog id=selllog status=selllog tr align=left valign=top s:hidden value=%{selllog.idSellLog} name=selllog[%{#selllog.index}].idSellLog disabled=true theme=simple / s:hidden value=%{selllog.shopbrandmaster.brandmaster.idBrandMaster} name=shopbrandmaster.brandmaster.idBrandMaster disabled=true theme=simple / tds:textfield value=%{shopbrandmaster.brandmaster.brandsName} disabled=true theme=simple //td tds:textfield value=%{openingBalence} name=openingBalence id=openingBalence disabled=true theme=simple //td tds:textfield value=%{receive} name=receive id=receive theme=simple //td tds:textfield value=%{transfer}name=transfer id=transfer theme=simple //td tds:textfield value=%{transferToComment}name=transferToComment id=transferToComment theme=simple //td tds:textfield id=TotalDayStock disabled=true theme=simple //td tds:textfield value=%{dayBrandRate}name=dayBrandRate id=dayBrandRate disabled=true theme=simple//td tds:textfield value=%{closingBalance}name=closingBalance id=closingBalance theme=simple //td tds:textfield id=sell disabled=true theme=simple //td tds:textfield id=totalBrandSale disabled=true theme=simple //td /tr /s:iterator In my Action I have public class shopLogEntry extends ActionSupport { private ListSelllog selllog; //getter and setter } and in action class I have getter and for setter selllog.it works fine when I am trying to get value in JSP. but after submitting it, i am not able to access the selllog List in my action .It is returning me as a null list. can anyone tell me where I am wrong. -- View this message in context: http://old.nabble.com/Struts2-iterator-tag-tp18258667p30987224.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 iterator tag
On Tue, Feb 22, 2011 at 11:21 AM, Jainitya wrote: I am also a newbie in struts 2 ,I dont know how to use this forum http://struts.apache.org/mail.html s:iterator value=selllog var=selllog id=selllog status=selllog tr align=left valign=top s:hidden value=%{selllog.idSellLog} disabled=true theme=simple name=selllog[%{#selllog.index}].idSellLog/ FWIW, I'm not sure this is valid HTML--have you run it through a validator? You're basically inserting elements between a TR and TD. but after submitting it, i am not able to access the selllog List in my action .It is returning me as a null list. This is the only thing that would set anything on the list, but it's disabled (which is weird for a hidden element), so the browser won't send it. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 iterator tag
First and foremost, I'd try to make cleaner the iterator definition: s:iterator value=selllog var=selllogVar status=selllogStatus On 22 February 2011 17:21, Jainitya jainitya.jaiys...@gmail.com wrote: Hi I am also a newbie in struts 2 ,I dont know how to use this forum so replying on this thread. I also have lookalike problem with Iterator tag My JSP is s:iterator value=selllog var=selllog id=selllog status=selllog tr align=left valign=top s:hidden value=%{selllog.idSellLog} name=selllog[%{#selllog.index}].idSellLog disabled=true theme=simple / s:hidden value=%{selllog.shopbrandmaster.brandmaster.idBrandMaster} name=shopbrandmaster.brandmaster.idBrandMaster disabled=true theme=simple / tds:textfield value=%{shopbrandmaster.brandmaster.brandsName} disabled=true theme=simple //td tds:textfield value=%{openingBalence} name=openingBalence id=openingBalence disabled=true theme=simple //td tds:textfield value=%{receive} name=receive id=receive theme=simple //td tds:textfield value=%{transfer}name=transfer id=transfer theme=simple //td tds:textfield value=%{transferToComment}name=transferToComment id=transferToComment theme=simple //td tds:textfield id=TotalDayStock disabled=true theme=simple //td tds:textfield value=%{dayBrandRate}name=dayBrandRate id=dayBrandRate disabled=true theme=simple//td tds:textfield value=%{closingBalance}name=closingBalance id=closingBalance theme=simple //td tds:textfield id=sell disabled=true theme=simple //td tds:textfield id=totalBrandSale disabled=true theme=simple //td /tr /s:iterator In my Action I have public class shopLogEntry extends ActionSupport { private ListSelllog selllog; //getter and setter } and in action class I have getter and for setter selllog.it works fine when I am trying to get value in JSP. but after submitting it, i am not able to access the selllog List in my action .It is returning me as a null list. can anyone tell me where I am wrong. -- View this message in context: http://old.nabble.com/Struts2-iterator-tag-tp18258667p30987224.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Maurizio Cucchiara - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 iterator tag
hi Dave I have updated my JSP as per your suggestion but still the issue is same. updated JSP s:iterator value=selllog id=selllogId status=selllogStatus tr align=left valign=top tds:textfield value=%{idSellLog} disabled=true theme=simple //td tds:textfield value=%{shopbrandmaster.brandmaster.idBrandMaster} name=shopbrandmaster disabled=true theme=simple //td tds:textfield value=%{shopbrandmaster.brandmaster.brandsName} disabled=true theme=simple //td tds:textfield value=%{openingBalence} name=openingBalence id=openingBalence disabled=true onchange=Total_Day_Stock(); theme=simple //td tds:textfield value=%{receive} name=receive id=receive onchange=Total_Day_Stock(); theme=simple //td tds:textfield value=%{transfer}name=transfer id=transfer onchange=Total_Day_Stock(); theme=simple //td tds:textfield value=%{transferToComment}name=transferToComment id=transferToComment theme=simple //td tds:textfield id=TotalDayStock disabled=true theme=simple //td tds:textfield value=%{dayBrandRate}name=dayBrandRate id=dayBrandRate disabled=true onchange=Total_Day_Stock(); theme=simple//td tds:textfield value=%{closingBalance}name=closingBalance id=closingBalance theme=simple //td tds:textfield id=sell disabled=true theme=simple //td tds:textfield id=totalBrandSale disabled=true theme=simple //td /tr /s:iterator Still when I am trying to access this list after submission it is returning me null value; :-(( -- View this message in context: http://old.nabble.com/Struts2-iterator-tag-tp18258667p30987872.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 iterator tag
On Tue, Feb 22, 2011 at 12:26 PM, Jainitya wrote: [JSP] Would it be possible for you to only include the actual stuff that matters? Editing stuff down is really helpful for people trying to focus on what's actually wrong. 1) http://struts.apache.org/2.x/docs/selecting-themes.html You may be able to avoid setting the theme on every single form field. 2) If the value is coming from an action property of the same name you shouldn't need to set the value explicitly. 3) You may be able to use the key attribute to eliminate setting both the id and name attributes (not sure how it interacts w/ the simple theme). I'd take a little time and poke around the framework a bit before proceeding much further--you'll save yourself, and those that have to maintain your code, some time and hassle. In any case: why *wouldn't* the list be null? You're not passing any form values that would populate it. Actions are created per request: any action properties not set by the form or by action code will be whatever their type's default value is. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 Iterator tag problem
Something like this: s:interator var=tempList value=dataList s:iterator var=number value=#tempList /s:iterator /s:iterator 2008/9/10 amolbehl [EMAIL PROTECTED]: Hi I am trying to display a ArrayList of lists using struts2 iterator tag. private void dataReady(){ for (int itr = 0; itr this.HOURS; itr++) { tempList = new ArrayList(); // Add all the till related data for(int tillItr = 0; tillItr this.terminalList.size(); tillItr++) { tempList.add(this.transactions[itr][tillItr]); tempList.add(this.unitsSold[itr][tillItr]); } // add all overall data tempList.add(this.peakBlocks[itr]); tempList.add(this.incCtr[itr]); tempList.add(this.percentages[itr]); /* * Now to place this list in the list which will * render it on the screen via JSP */ this.dataList.add(tempList); } } Now I have tempList which is a list of int and long values and dataList which is a list of tempLists. I need to use the struts2 iterator tag and display it on the screen. Is there any way of doing it? If Iterator is not possible then is there anything else I can use? -- View this message in context: http://www.nabble.com/Struts2-Iterator-tag-problem-tp19414606p19414606.html Sent from the Struts - User mailing list archive at Nabble.com. - 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: Struts2 iterator tag
Try the following: s:textarea name=%{'descList[' + #stat.index + '].destination'} value=%{destination}/ Hope it helps! BGE Ger wrote: Hello, I'm struts(2) newbie and I need some help for the iterator tag. How can I access to an updated list in the action class? My JSP looks like: s:form theme=simple s:iterator value=descList status=stat tr td s:textarea name=descList[%{stat.index}].destination value=%{destination}//td td s:textarea name=descList[%{stat.index}].category value=%{category} //td td s:textarea name=descrList[%{stat.index}].source value=%{source} //td tds:textarea name=descList[%{stat.index}].text value=%{text}//td /tr /s:iterator s:submit action=updateDescriptions / /s:form - Action class: public class DescriptionTestAction extends ActionSupport { private ListText descList; public DescriptionTestAction () { } public void setDescList(List descList) { this.descList = descList; } public List getDescList () { return this.descList; } -- The descList is a spring Bean and everything works well except the update process. If I make an update for the destination field e.g. and then submit this form the descList contains the old values! I've tried everything and spend lot of time for searching for a solution, please help! Thank you in advance! -- View this message in context: http://www.nabble.com/Struts2-iterator-tag-tp18258667p18353278.html 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: Struts2 iterator tag
The only syntax difference I see is you should put #stat.index rather than stat.index so it looks like s:textarea name=descList[%{#stat.index}].destination value=%{destination} /gt; I am assuming you have the proper setter for setDescList(ListText descList) in your action. BGE Ger wrote: Hi Laurie, thank you for help! you are right that's what I want: to push back the updated fields into the list. And then I want access the updated fields in the update action class . I think maybe there is somesthing wrong in my tag syntax? I found out that I must use {} instead of [] which is only for maps, but it also doesn't work. I try this example but it doesn't work: http://www.vitarara.org/cms/struts_2_cookbook/updating_a_list_of_domain_entities Is there any other example anywhere, which I've not found? I'm really desperate! What I want is not unusual, I've thought. This must work til tomorrow (for my company) :-(( Thank you very much for helping! Laurie Harper wrote: I'm not sure what you mean by a 'submit in each row' but if you want to push data back into the list then yes, you need the index in the input's name as you have. L. BGE Ger wrote: thank you for the answer! But I've read, if I want to change the complete list with the submit action. I must use the list index. If I make a submit in each row I can use destination syntax. Isn't it right? Jim Kiley wrote: For starters, you can simplify things a lot by changing your syntax from: name=descList[%{stat.index}].destination to just: name=destination The iterator tag pushes descList[index] onto the OGNL stack in every iteration, so you can refer to its attributes directly. jk On Thu, Jul 3, 2008 at 8:55 AM, BGE Ger [EMAIL PROTECTED] wrote: Hello, I'm struts(2) newbie and I need some help for the iterator tag. How can I access to an updated list in the action class? My JSP looks like: s:form theme=simple s:iterator value=descList status=stat tr td s:textarea name=descList[%{stat.index}].destination value=%{destination} //td td s:textarea name=descList[%{stat.index}].category value=%{category} //td td s:textarea name=descrList[%{stat.index}].source value=%{source} //td tds:textarea name=descList[%{stat.index}].text value=%{text}//td /tr /s:iterator s:submit action=updateDescriptions / /s:form - Action class: public class DescriptionTestAction extends ActionSupport { private ListText descList; public DescriptionTestAction () { } public void setDescList(List descList) { this.descList = descList; } public List getDescList () { return this.descList; } -- The descList is a spring Bean and everything works well except the update process. If I make an update for the destination field e.g. and then submit this form the descList contains the old values! I've tried everything and spend lot of time for searching for a solution, please help! Thank you in advance! -- View this message in context: http://www.nabble.com/Struts2-iterator-tag-tp18258667p18258667.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Struts2-iterator-tag-tp18258667p18298656.html 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: Struts2 iterator tag
For starters, you can simplify things a lot by changing your syntax from: name=descList[%{stat.index}].destination to just: name=destination The iterator tag pushes descList[index] onto the OGNL stack in every iteration, so you can refer to its attributes directly. jk On Thu, Jul 3, 2008 at 8:55 AM, BGE Ger [EMAIL PROTECTED] wrote: Hello, I'm struts(2) newbie and I need some help for the iterator tag. How can I access to an updated list in the action class? My JSP looks like: s:form theme=simple s:iterator value=descList status=stat tr td s:textarea name=descList[%{stat.index}].destination value=%{destination} //td td s:textarea name=descList[%{stat.index}].category value=%{category} //td td s:textarea name=descrList[%{stat.index}].source value=%{source} //td tds:textarea name=descList[%{stat.index}].text value=%{text}//td /tr /s:iterator s:submit action=updateDescriptions / /s:form - Action class: public class DescriptionTestAction extends ActionSupport { private ListText descList; public DescriptionTestAction () { } public void setDescList(List descList) { this.descList = descList; } public List getDescList () { return this.descList; } -- The descList is a spring Bean and everything works well except the update process. If I make an update for the destination field e.g. and then submit this form the descList contains the old values! I've tried everything and spend lot of time for searching for a solution, please help! Thank you in advance! -- View this message in context: http://www.nabble.com/Struts2-iterator-tag-tp18258667p18258667.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: Struts2 iterator tag
...thank you for the answer! But I've read, if I want to change the complete list with the submit action. I must use the list index. If I make a submit in each row I can use destination syntax. Isn't it right? Jim Kiley wrote: For starters, you can simplify things a lot by changing your syntax from: name=descList[%{stat.index}].destination to just: name=destination The iterator tag pushes descList[index] onto the OGNL stack in every iteration, so you can refer to its attributes directly. jk On Thu, Jul 3, 2008 at 8:55 AM, BGE Ger [EMAIL PROTECTED] wrote: Hello, I'm struts(2) newbie and I need some help for the iterator tag. How can I access to an updated list in the action class? My JSP looks like: s:form theme=simple s:iterator value=descList status=stat tr td s:textarea name=descList[%{stat.index}].destination value=%{destination} //td td s:textarea name=descList[%{stat.index}].category value=%{category} //td td s:textarea name=descrList[%{stat.index}].source value=%{source} //td tds:textarea name=descList[%{stat.index}].text value=%{text}//td /tr /s:iterator s:submit action=updateDescriptions / /s:form - Action class: public class DescriptionTestAction extends ActionSupport { private ListText descList; public DescriptionTestAction () { } public void setDescList(List descList) { this.descList = descList; } public List getDescList () { return this.descList; } -- The descList is a spring Bean and everything works well except the update process. If I make an update for the destination field e.g. and then submit this form the descList contains the old values! I've tried everything and spend lot of time for searching for a solution, please help! Thank you in advance! -- View this message in context: http://www.nabble.com/Struts2-iterator-tag-tp18258667p18258667.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com -- View this message in context: http://www.nabble.com/Struts2-iterator-tag-tp18258667p18259056.html 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: Struts2 iterator tag
I'm not sure what you mean by a 'submit in each row' but if you want to push data back into the list then yes, you need the index in the input's name as you have. L. BGE Ger wrote: thank you for the answer! But I've read, if I want to change the complete list with the submit action. I must use the list index. If I make a submit in each row I can use destination syntax. Isn't it right? Jim Kiley wrote: For starters, you can simplify things a lot by changing your syntax from: name=descList[%{stat.index}].destination to just: name=destination The iterator tag pushes descList[index] onto the OGNL stack in every iteration, so you can refer to its attributes directly. jk On Thu, Jul 3, 2008 at 8:55 AM, BGE Ger [EMAIL PROTECTED] wrote: Hello, I'm struts(2) newbie and I need some help for the iterator tag. How can I access to an updated list in the action class? My JSP looks like: s:form theme=simple s:iterator value=descList status=stat tr td s:textarea name=descList[%{stat.index}].destination value=%{destination} //td td s:textarea name=descList[%{stat.index}].category value=%{category} //td td s:textarea name=descrList[%{stat.index}].source value=%{source} //td tds:textarea name=descList[%{stat.index}].text value=%{text}//td /tr /s:iterator s:submit action=updateDescriptions / /s:form - Action class: public class DescriptionTestAction extends ActionSupport { private ListText descList; public DescriptionTestAction () { } public void setDescList(List descList) { this.descList = descList; } public List getDescList () { return this.descList; } -- The descList is a spring Bean and everything works well except the update process. If I make an update for the destination field e.g. and then submit this form the descList contains the old values! I've tried everything and spend lot of time for searching for a solution, please help! Thank you in advance! -- View this message in context: http://www.nabble.com/Struts2-iterator-tag-tp18258667p18258667.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts2 iterator tag
BGE Ger wrote: Hello, I'm struts(2) newbie and I need some help for the iterator tag. How can I access to an updated list in the action class? My JSP looks like: s:form theme=simple s:iterator value=descList status=stat tr td s:textarea name=descList[%{stat.index}].destination value=%{destination}//td td s:textarea name=descList[%{stat.index}].category value=%{category} //td td s:textarea name=descrList[%{stat.index}].source value=%{source} //td tds:textarea name=descList[%{stat.index}].text value=%{text}//td /tr /s:iterator s:submit action=updateDescriptions / /s:form - Action class: public class DescriptionTestAction extends ActionSupport { private ListText descList; public DescriptionTestAction () { } public void setDescList(List descList) { this.descList = descList; } public List getDescList () { return this.descList; } -- The descList is a spring Bean and everything works well except the update process. If I make an update for the destination field e.g. and then submit this form the descList contains the old values! I've tried everything and spend lot of time for searching for a solution, please help! Thank you in advance! What do you mean that descList is a spring bean? Is it being injected into the action by Spring? If so, perhaps that is happening after the parameters are set (so overwriting the submitted values). Try tracing calls to setDescList() to see if it is being called from multiple places and, if so, in what order. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts2 iterator tag
Hi Laurie, thank you for help! you are right that's what I want: to push back the updated fields into the list. And then I want access the updated fields in the update action class . I think maybe there is somesthing wrong in my tag syntax? I found out that I must use {} instead of [] which is only for maps, but it also doesn't work. I try this example but it doesn't work: http://www.vitarara.org/cms/struts_2_cookbook/updating_a_list_of_domain_entities Is there any other example anywhere, which I've not found? I'm really desperate! What I want is not unusual, I've thought. This must work til tomorrow (for my company) :-(( Thank you very much for helping! Laurie Harper wrote: I'm not sure what you mean by a 'submit in each row' but if you want to push data back into the list then yes, you need the index in the input's name as you have. L. BGE Ger wrote: thank you for the answer! But I've read, if I want to change the complete list with the submit action. I must use the list index. If I make a submit in each row I can use destination syntax. Isn't it right? Jim Kiley wrote: For starters, you can simplify things a lot by changing your syntax from: name=descList[%{stat.index}].destination to just: name=destination The iterator tag pushes descList[index] onto the OGNL stack in every iteration, so you can refer to its attributes directly. jk On Thu, Jul 3, 2008 at 8:55 AM, BGE Ger [EMAIL PROTECTED] wrote: Hello, I'm struts(2) newbie and I need some help for the iterator tag. How can I access to an updated list in the action class? My JSP looks like: s:form theme=simple s:iterator value=descList status=stat tr td s:textarea name=descList[%{stat.index}].destination value=%{destination} //td td s:textarea name=descList[%{stat.index}].category value=%{category} //td td s:textarea name=descrList[%{stat.index}].source value=%{source} //td tds:textarea name=descList[%{stat.index}].text value=%{text}//td /tr /s:iterator s:submit action=updateDescriptions / /s:form - Action class: public class DescriptionTestAction extends ActionSupport { private ListText descList; public DescriptionTestAction () { } public void setDescList(List descList) { this.descList = descList; } public List getDescList () { return this.descList; } -- The descList is a spring Bean and everything works well except the update process. If I make an update for the destination field e.g. and then submit this form the descList contains the old values! I've tried everything and spend lot of time for searching for a solution, please help! Thank you in advance! -- View this message in context: http://www.nabble.com/Struts2-iterator-tag-tp18258667p18258667.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Struts2-iterator-tag-tp18258667p18266957.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]