Re: adding values to a variable inside iterator tag

2009-07-03 Thread dusty
cribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > -- View this message in context: http://www.nabble.com/adding-values-to-a-variable-inside-iterator-tag-tp24256987p24326480.html Sent from the Struts - User mailing

Re: adding values to a variable inside iterator tag

2009-07-02 Thread Dale Newfield
Bhaarat Sharma wrote: But in this case why would I write another for loop to do something that can be done in the for loop that I already have? Maybe learning about the life cycle of even a simple tag will convince you that doing unnecessary computation within the display layer is a mistake:

Re: adding values to a variable inside iterator tag

2009-07-01 Thread Bhaarat Sharma
thanks for your advice. "...optimizing out a for loop is not the best use of your time as a developer." I second that. But in this case why would I write another for loop to do something that can be done in the for loop that I already have? Unless there is an issue with doing this inside s:itera

Re: adding values to a variable inside iterator tag

2009-07-01 Thread Jim Kiley
I will bet one dollar that the amount of time it takes to calculate this value inside your Action class is less than or equal to the time it takes it to calculate the value inside the iterator in your JSP. And it's a vanishingly small amount compared to network latency. Unless you're writing code

Re: adding values to a variable inside iterator tag

2009-07-01 Thread Bhaarat Sharma
but if I do it in my action class then I am adding extra 'time'. to begin with I anyways have to iterate over the list in my JSP. Just to calculate total if I iterate over the list again in java code then I am doing two iterations through the list. Just didnt seem very efficient for my need. Tha

Re: adding values to a variable inside iterator tag

2009-07-01 Thread Jim Kiley
I don't know how Struts 2 tags work under the hood, but it's possible that it's going out of scope because you declared it in the iterator, or it's silently throwing an error because it isn't initialized. Before your starts, do . This could be handled inside your action class with like two lines

Re: adding values to a variable inside iterator tag

2009-07-01 Thread Bhaarat Sharma
oh nevermind. was experimenting and works! bless OGNL On Wed, Jul 1, 2009 at 4:55 PM, Bhaarat Sharma wrote: > no :( > I tried the following > > "totalCount"/> > value="%{calcTotalDebtAmt+totalCount}"/> > > > and tried to print it > > > but it shows nothing :( > > On Wed, Ju

Re: adding values to a variable inside iterator tag

2009-07-01 Thread Bhaarat Sharma
no :( I tried the following and tried to print it but it shows nothing :( On Wed, Jul 1, 2009 at 4:41 PM, Jim Kiley wrote: > Does it work if you replace the "+=" with a "+"? > jk > > On Wed, Jul 1, 2009 at 4:39 PM, Bhaarat Sharma > wrote: > > > Does anyone know how to calcu

Re: adding values to a variable inside iterator tag

2009-07-01 Thread Jim Kiley
Does it work if you replace the "+=" with a "+"? jk On Wed, Jul 1, 2009 at 4:39 PM, Bhaarat Sharma wrote: > Does anyone know how to calculate the total value by making use of the > tag? > On Mon, Jun 29, 2009 at 1:16 PM, Bhaarat Sharma > wrote: > > > for our purpose i'd prefer doing it in the

Re: adding values to a variable inside iterator tag

2009-07-01 Thread Bhaarat Sharma
Does anyone know how to calculate the total value by making use of the tag? On Mon, Jun 29, 2009 at 1:16 PM, Bhaarat Sharma wrote: > for our purpose i'd prefer doing it in the iterator tag. > I tried something like this > > > > but this does not seem to work. > > what can fix this? > > > On Mon

Re: adding values to a variable inside iterator tag

2009-06-29 Thread Bhaarat Sharma
for our purpose i'd prefer doing it in the iterator tag. I tried something like this but this does not seem to work. what can fix this? On Mon, Jun 29, 2009 at 12:08 PM, Jim Kiley wrote: > You're far better off doing it inside the Action class. > That said, you can probably use s:set to get

Re: adding values to a variable inside iterator tag

2009-06-29 Thread Jim Kiley
You're far better off doing it inside the Action class. That said, you can probably use s:set to get what you want. jk On Mon, Jun 29, 2009 at 12:03 PM, Bhaarat Sharma wrote: > Hi, > I have a simple iterator tag like the following > > > > > > > > is there a way to get the total of value1 a

adding values to a variable inside iterator tag

2009-06-29 Thread Bhaarat Sharma
Hi, I have a simple iterator tag like the following is there a way to get the total of value1 at the end of this iterator tag? basically in java we would do totalValue += value1; and then at the end of the loop we would have total of value1. Is that possible to do with an iterator tag?