You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Bhaarat Sharma <bh...@gmail.com> on 2009/05/30 05:34:10 UTC

why doesnt iterator tag provide 'next'

Iterator it = myList.iterator()
while (it.hasNext())
{
SomeClass ob1 = (SomeClass) it.next();
SomeClass ob2 = (SomeClass) it.next();
//do something
}

why can we not achieve the same with s:iterator tag.

What was the reasoning behind not providing a 'next' or something similar?

Re: why doesnt iterator tag provide 'next'

Posted by Bhaarat Sharma <bh...@gmail.com>.
I have not started on it yet.  Dave, how would you do it with OGNL? can we
write our own?

I have something like this in mind

<s:iteratorNext value = "myList">
    <s:property value="someMethodFirstItem"/>

    <s:property value="someMethodSecondItem" nextNum="1"/>

    <s:property value="someMethodThirdItem" nextNum="2"/>

</s:iteratorNext>

...how would you do it?

On Sat, May 30, 2009 at 8:34 PM, Dave Newton <ne...@yahoo.com> wrote:

> Bhaarat Sharma wrote:
>
>> This is not a 'break' tag...this would work same as in iterator tag BUT
>> would also have a functionality where the user can go to the next element
>> within the iteration.
>>
>
> IMO depending on ordering within a collection is an accident waiting to
> happen, but the functionality itself shouldn't be much more difficult.
>
> FWIW, this functionality could most likely be achieved via OGNL and a
> couple of collection operations or, less cleanly, via subset/decider.
>
> A break tag would be nice, though.
>
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: why doesnt iterator tag provide 'next'

Posted by Dave Newton <ne...@yahoo.com>.
Bhaarat Sharma wrote:
> This is not a 'break' tag...this would work same as in iterator tag BUT
> would also have a functionality where the user can go to the next element
> within the iteration.

IMO depending on ordering within a collection is an accident waiting to 
happen, but the functionality itself shouldn't be much more difficult.

FWIW, this functionality could most likely be achieved via OGNL and a 
couple of collection operations or, less cleanly, via subset/decider.

A break tag would be nice, though.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: why doesnt iterator tag provide 'next'

Posted by Dave Newton <ne...@yahoo.com>.
Bhaarat Sharma wrote:
 > <s:iterate value="iterList" statue="stat">
 >  <s:property value="((myClass)dataList.get(stat)).someClassMethod"/>
 >  <s:property value="((myClass)dataList.get(stat+1)).someClassMethod"/>
 > </s:iterate>

<s:iterate value="iterList" var="stat">
   <s:property value="dataList[#stat].someClassMethod()"/>
   <s:property value="dataList[#stat+1].someClassMethod()"/>
</s:iterate>

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: why doesnt iterator tag provide 'next'

Posted by Bhaarat Sharma <bh...@gmail.com>.
i see that musachy added support for this
http://svn.apache.org/viewvc?view=rev&revision=741179
Mushacy, is this ready to be used?

On Tue, Jun 2, 2009 at 2:10 AM, Bhaarat Sharma <bh...@gmail.com> wrote:

> currently, I am not using jstl tags at all inmy application.
> Isnt there anyway to achive this using strictly struts2 tags?
>
>
> On Tue, Jun 2, 2009 at 1:50 AM, Chris Pratt <th...@gmail.com>wrote:
>
>> You can use the <c:forEach> tag for that type of iteration.
>>   (*Chris*)
>>
>> On Mon, Jun 1, 2009 at 10:36 PM, Bhaarat Sharma <bh...@gmail.com>
>> wrote:
>>
>> > <s:iterator begin="%{1}" end="%{dataList.size()}" step="%{2}">
>> > </s:iterator>
>> >
>> >
>> > the above properties dont seem to be there for iterator tag.
>> >
>> > I am doing something like this:
>> >
>> > <s:iterator status="stat" value="(secondResultSet.size()/3).{ #this }" >
>> >   <s:property value="#stat.count" /> <!-- Note that "count" is 1-based,
>> > "index" is 0-based. -->
>> >   <s:property value="secondResultSet.get(#stat.index).altId" />
>> >   <s:property value="secondResultSet.get(#stat.index+1).altId" />
>> >   <s:property value="secondResultSet.get(#stat.index+2).altId" />
>> > </s:iterator>
>> >
>> > But this way, In first iteration I am getting elements 0, 1 and 2 but in
>> > second iteration I Am again getting elements 1, 2 and 3 instead in first
>> > iteration I want to get elements 0, 1, 2 and in second iteration get 3,
>> 4,
>> > 5
>> > and so on....
>> >
>> > begin, end, step seems like would work but I get compilation errors when
>> > using those since the TLD does not support them
>> > On Tue, Jun 2, 2009 at 1:21 AM, Bhaarat Sharma <bh...@gmail.com>
>> > wrote:
>> >
>> > > thanks dale.
>> > > Your solutions seems to be very good.
>> > >
>> > > Could you or someone else please explain what exactly this line means?
>> > >
>> > > <s:iterator value="%{(dataList.size()).{?(#this%2)==(#this/2)}}" >
>> > > </s:iterator>
>> > >
>> > > On Sun, May 31, 2009 at 10:58 AM, Dale Newfield <da...@newfield.org>
>> > wrote:
>> > >
>> > >> Bhaarat Sharma wrote:
>> > >>
>> > >>> So I'll have something like this to create my iteratorList
>> > >>>
>> > >>> int sizeList = dataList.size();
>> > >>> List iterList = new ArrayList();
>> > >>>
>> > >>> for (i = 0; i <= sizeList; i=i+2)
>> > >>> {
>> > >>>   iterList.add(i);
>> > >>> }
>> > >>>
>> > >>>
>> > >>>    So now I have a iterList. I can iterate over it in my struts2
>> code
>> > >>>
>> > >>> <s:iterate value="iterList" statue="stat">
>> > >>>    <s:property
>> value="((myClass)dataList.get(stat)).someClassMethod"/>
>> > >>> <!--first item of dataList ->
>> > >>>
>> > >>>    <s:property
>> > value="((myClass)dataList.get(stat+1)).someClassMethod"/>
>> > >>> <!--second item of dataList ->
>> > >>>
>> > >>> </s:iterate>
>> > >>>
>> > >>
>> > >> You can do this completely within the jsp in a number of ways:
>> > >>
>> > >> <s:iterator value="%{(dataList.size()).{?(#this%2)==(#this/2)}}" >
>> > >> </s:iterator>
>> > >>
>> > >> <s:iterator value="%{datalist}" status="iterStatus">
>> > >>  <s:if test="#rowstatus.odd == true">
>> > >>    ...
>> > >>  </s:if>
>> > >>  <s:else>
>> > >>    ...
>> > >>  </s:else>
>> > >> </s:iterator>
>> > >>
>> > >> <s:iterator begin="%{1}" end="%{dataList.size()}" step="%{2}">
>> > >> </s:iterator>
>> > >>
>> > >> -Dale
>> > >>
>> > >>
>> > >> ---------------------------------------------------------------------
>> > >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> > >> For additional commands, e-mail: user-help@struts.apache.org
>> > >>
>> > >>
>> > >
>> >
>>
>
>

Re: why doesnt iterator tag provide 'next'

Posted by Bhaarat Sharma <bh...@gmail.com>.
currently, I am not using jstl tags at all inmy application.
Isnt there anyway to achive this using strictly struts2 tags?

On Tue, Jun 2, 2009 at 1:50 AM, Chris Pratt <th...@gmail.com> wrote:

> You can use the <c:forEach> tag for that type of iteration.
>   (*Chris*)
>
> On Mon, Jun 1, 2009 at 10:36 PM, Bhaarat Sharma <bh...@gmail.com>
> wrote:
>
> > <s:iterator begin="%{1}" end="%{dataList.size()}" step="%{2}">
> > </s:iterator>
> >
> >
> > the above properties dont seem to be there for iterator tag.
> >
> > I am doing something like this:
> >
> > <s:iterator status="stat" value="(secondResultSet.size()/3).{ #this }" >
> >   <s:property value="#stat.count" /> <!-- Note that "count" is 1-based,
> > "index" is 0-based. -->
> >   <s:property value="secondResultSet.get(#stat.index).altId" />
> >   <s:property value="secondResultSet.get(#stat.index+1).altId" />
> >   <s:property value="secondResultSet.get(#stat.index+2).altId" />
> > </s:iterator>
> >
> > But this way, In first iteration I am getting elements 0, 1 and 2 but in
> > second iteration I Am again getting elements 1, 2 and 3 instead in first
> > iteration I want to get elements 0, 1, 2 and in second iteration get 3,
> 4,
> > 5
> > and so on....
> >
> > begin, end, step seems like would work but I get compilation errors when
> > using those since the TLD does not support them
> > On Tue, Jun 2, 2009 at 1:21 AM, Bhaarat Sharma <bh...@gmail.com>
> > wrote:
> >
> > > thanks dale.
> > > Your solutions seems to be very good.
> > >
> > > Could you or someone else please explain what exactly this line means?
> > >
> > > <s:iterator value="%{(dataList.size()).{?(#this%2)==(#this/2)}}" >
> > > </s:iterator>
> > >
> > > On Sun, May 31, 2009 at 10:58 AM, Dale Newfield <da...@newfield.org>
> > wrote:
> > >
> > >> Bhaarat Sharma wrote:
> > >>
> > >>> So I'll have something like this to create my iteratorList
> > >>>
> > >>> int sizeList = dataList.size();
> > >>> List iterList = new ArrayList();
> > >>>
> > >>> for (i = 0; i <= sizeList; i=i+2)
> > >>> {
> > >>>   iterList.add(i);
> > >>> }
> > >>>
> > >>>
> > >>>    So now I have a iterList. I can iterate over it in my struts2 code
> > >>>
> > >>> <s:iterate value="iterList" statue="stat">
> > >>>    <s:property
> value="((myClass)dataList.get(stat)).someClassMethod"/>
> > >>> <!--first item of dataList ->
> > >>>
> > >>>    <s:property
> > value="((myClass)dataList.get(stat+1)).someClassMethod"/>
> > >>> <!--second item of dataList ->
> > >>>
> > >>> </s:iterate>
> > >>>
> > >>
> > >> You can do this completely within the jsp in a number of ways:
> > >>
> > >> <s:iterator value="%{(dataList.size()).{?(#this%2)==(#this/2)}}" >
> > >> </s:iterator>
> > >>
> > >> <s:iterator value="%{datalist}" status="iterStatus">
> > >>  <s:if test="#rowstatus.odd == true">
> > >>    ...
> > >>  </s:if>
> > >>  <s:else>
> > >>    ...
> > >>  </s:else>
> > >> </s:iterator>
> > >>
> > >> <s:iterator begin="%{1}" end="%{dataList.size()}" step="%{2}">
> > >> </s:iterator>
> > >>
> > >> -Dale
> > >>
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > >> For additional commands, e-mail: user-help@struts.apache.org
> > >>
> > >>
> > >
> >
>

Re: why doesnt iterator tag provide 'next'

Posted by Chris Pratt <th...@gmail.com>.
You can use the <c:forEach> tag for that type of iteration.
  (*Chris*)

On Mon, Jun 1, 2009 at 10:36 PM, Bhaarat Sharma <bh...@gmail.com> wrote:

> <s:iterator begin="%{1}" end="%{dataList.size()}" step="%{2}">
> </s:iterator>
>
>
> the above properties dont seem to be there for iterator tag.
>
> I am doing something like this:
>
> <s:iterator status="stat" value="(secondResultSet.size()/3).{ #this }" >
>   <s:property value="#stat.count" /> <!-- Note that "count" is 1-based,
> "index" is 0-based. -->
>   <s:property value="secondResultSet.get(#stat.index).altId" />
>   <s:property value="secondResultSet.get(#stat.index+1).altId" />
>   <s:property value="secondResultSet.get(#stat.index+2).altId" />
> </s:iterator>
>
> But this way, In first iteration I am getting elements 0, 1 and 2 but in
> second iteration I Am again getting elements 1, 2 and 3 instead in first
> iteration I want to get elements 0, 1, 2 and in second iteration get 3, 4,
> 5
> and so on....
>
> begin, end, step seems like would work but I get compilation errors when
> using those since the TLD does not support them
> On Tue, Jun 2, 2009 at 1:21 AM, Bhaarat Sharma <bh...@gmail.com>
> wrote:
>
> > thanks dale.
> > Your solutions seems to be very good.
> >
> > Could you or someone else please explain what exactly this line means?
> >
> > <s:iterator value="%{(dataList.size()).{?(#this%2)==(#this/2)}}" >
> > </s:iterator>
> >
> > On Sun, May 31, 2009 at 10:58 AM, Dale Newfield <da...@newfield.org>
> wrote:
> >
> >> Bhaarat Sharma wrote:
> >>
> >>> So I'll have something like this to create my iteratorList
> >>>
> >>> int sizeList = dataList.size();
> >>> List iterList = new ArrayList();
> >>>
> >>> for (i = 0; i <= sizeList; i=i+2)
> >>> {
> >>>   iterList.add(i);
> >>> }
> >>>
> >>>
> >>>    So now I have a iterList. I can iterate over it in my struts2 code
> >>>
> >>> <s:iterate value="iterList" statue="stat">
> >>>    <s:property value="((myClass)dataList.get(stat)).someClassMethod"/>
> >>> <!--first item of dataList ->
> >>>
> >>>    <s:property
> value="((myClass)dataList.get(stat+1)).someClassMethod"/>
> >>> <!--second item of dataList ->
> >>>
> >>> </s:iterate>
> >>>
> >>
> >> You can do this completely within the jsp in a number of ways:
> >>
> >> <s:iterator value="%{(dataList.size()).{?(#this%2)==(#this/2)}}" >
> >> </s:iterator>
> >>
> >> <s:iterator value="%{datalist}" status="iterStatus">
> >>  <s:if test="#rowstatus.odd == true">
> >>    ...
> >>  </s:if>
> >>  <s:else>
> >>    ...
> >>  </s:else>
> >> </s:iterator>
> >>
> >> <s:iterator begin="%{1}" end="%{dataList.size()}" step="%{2}">
> >> </s:iterator>
> >>
> >> -Dale
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
>

Re: why doesnt iterator tag provide 'next'

Posted by Dale Newfield <da...@newfield.org>.
Bhaarat Sharma wrote:
> <s:iterator begin="%{1}" end="%{dataList.size()}" step="%{2}">
> </s:iterator>
> 
> the above properties dont seem to be there for iterator tag.

2.1.7 (RC, anyway) is due out RSN.

> I am doing something like this:
> 
> <s:iterator status="stat" value="(secondResultSet.size()/3).{ #this }" >

the contents of stat are defined by:
http://struts.apache.org/2.x/struts2-core/apidocs/org/apache/struts2/views/jsp/IteratorStatus.html

The contents of the ONGL expression in value determine what's on top of 
the stack each time through the loop.
Let's say your list has 24 entries.
(secondResultSet.size()/3) = 8
(8).{#this} is the list (0 1 2 3 4 5 6 7) (double check that, though--it 
might be (1 2 3 4 5 6 7 8).)

The funky expression I had earlier started with all the values 0..23 and 
trimmed out those I didn't want:
(secondResultSet.size()).{? (#this/3)==(#this%3)}

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: why doesnt iterator tag provide 'next'

Posted by Bhaarat Sharma <bh...@gmail.com>.
<s:iterator begin="%{1}" end="%{dataList.size()}" step="%{2}">
</s:iterator>


the above properties dont seem to be there for iterator tag.

I am doing something like this:

<s:iterator status="stat" value="(secondResultSet.size()/3).{ #this }" >
   <s:property value="#stat.count" /> <!-- Note that "count" is 1-based,
"index" is 0-based. -->
   <s:property value="secondResultSet.get(#stat.index).altId" />
   <s:property value="secondResultSet.get(#stat.index+1).altId" />
   <s:property value="secondResultSet.get(#stat.index+2).altId" />
</s:iterator>

But this way, In first iteration I am getting elements 0, 1 and 2 but in
second iteration I Am again getting elements 1, 2 and 3 instead in first
iteration I want to get elements 0, 1, 2 and in second iteration get 3, 4, 5
and so on....

begin, end, step seems like would work but I get compilation errors when
using those since the TLD does not support them
On Tue, Jun 2, 2009 at 1:21 AM, Bhaarat Sharma <bh...@gmail.com> wrote:

> thanks dale.
> Your solutions seems to be very good.
>
> Could you or someone else please explain what exactly this line means?
>
> <s:iterator value="%{(dataList.size()).{?(#this%2)==(#this/2)}}" >
> </s:iterator>
>
> On Sun, May 31, 2009 at 10:58 AM, Dale Newfield <da...@newfield.org> wrote:
>
>> Bhaarat Sharma wrote:
>>
>>> So I'll have something like this to create my iteratorList
>>>
>>> int sizeList = dataList.size();
>>> List iterList = new ArrayList();
>>>
>>> for (i = 0; i <= sizeList; i=i+2)
>>> {
>>>   iterList.add(i);
>>> }
>>>
>>>
>>>    So now I have a iterList. I can iterate over it in my struts2 code
>>>
>>> <s:iterate value="iterList" statue="stat">
>>>    <s:property value="((myClass)dataList.get(stat)).someClassMethod"/>
>>> <!--first item of dataList ->
>>>
>>>    <s:property value="((myClass)dataList.get(stat+1)).someClassMethod"/>
>>> <!--second item of dataList ->
>>>
>>> </s:iterate>
>>>
>>
>> You can do this completely within the jsp in a number of ways:
>>
>> <s:iterator value="%{(dataList.size()).{?(#this%2)==(#this/2)}}" >
>> </s:iterator>
>>
>> <s:iterator value="%{datalist}" status="iterStatus">
>>  <s:if test="#rowstatus.odd == true">
>>    ...
>>  </s:if>
>>  <s:else>
>>    ...
>>  </s:else>
>> </s:iterator>
>>
>> <s:iterator begin="%{1}" end="%{dataList.size()}" step="%{2}">
>> </s:iterator>
>>
>> -Dale
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>

Re: why doesnt iterator tag provide 'next'

Posted by Dave Newton <ne...@yahoo.com>.
Bhaarat Sharma wrote:
> Could you or someone else please explain what exactly this line means?
> 
> <s:iterator value="%{(dataList.size()).{?(#this%2)==(#this/2)}}" >
> </s:iterator>

It's explained in the OGNL documentation.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: why doesnt iterator tag provide 'next'

Posted by Bhaarat Sharma <bh...@gmail.com>.
thanks dale.
Your solutions seems to be very good.

Could you or someone else please explain what exactly this line means?

<s:iterator value="%{(dataList.size()).{?(#this%2)==(#this/2)}}" >
</s:iterator>

On Sun, May 31, 2009 at 10:58 AM, Dale Newfield <da...@newfield.org> wrote:

> Bhaarat Sharma wrote:
>
>> So I'll have something like this to create my iteratorList
>>
>> int sizeList = dataList.size();
>> List iterList = new ArrayList();
>>
>> for (i = 0; i <= sizeList; i=i+2)
>> {
>>   iterList.add(i);
>> }
>>
>>
>>    So now I have a iterList. I can iterate over it in my struts2 code
>>
>> <s:iterate value="iterList" statue="stat">
>>    <s:property value="((myClass)dataList.get(stat)).someClassMethod"/>
>> <!--first item of dataList ->
>>
>>    <s:property value="((myClass)dataList.get(stat+1)).someClassMethod"/>
>> <!--second item of dataList ->
>>
>> </s:iterate>
>>
>
> You can do this completely within the jsp in a number of ways:
>
> <s:iterator value="%{(dataList.size()).{?(#this%2)==(#this/2)}}" >
> </s:iterator>
>
> <s:iterator value="%{datalist}" status="iterStatus">
>  <s:if test="#rowstatus.odd == true">
>    ...
>  </s:if>
>  <s:else>
>    ...
>  </s:else>
> </s:iterator>
>
> <s:iterator begin="%{1}" end="%{dataList.size()}" step="%{2}">
> </s:iterator>
>
> -Dale
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: why doesnt iterator tag provide 'next'

Posted by Dave Newton <ne...@yahoo.com>.
Dale Newfield wrote:
> <s:iterator value="%{(dataList.size()).{?(#this%2)==(#this/2)}}" >

Heeheehee. That makes me feel all warm and fuzzy inside. I love abusing 
OGNL, although at my current gig I'm banned :/

> <s:iterator value="%{datalist}" status="iterStatus">
>   <s:if test="#rowstatus.odd == true">
>     ...
>   </s:if>
>   <s:else>
>     ...
>   </s:else>
> </s:iterator>

That was my pseudo-code solution, but it got shot down :'(

> <s:iterator begin="%{1}" end="%{dataList.size()}" step="%{2}">

Oh, right! I wish I could remember they're there.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: why doesnt iterator tag provide 'next'

Posted by Dale Newfield <da...@newfield.org>.
Bhaarat Sharma wrote:
> So I'll have something like this to create my iteratorList
> 
> int sizeList = dataList.size();
> List iterList = new ArrayList();
> 
> for (i = 0; i <= sizeList; i=i+2)
> {
>    iterList.add(i);
> }
> 
> 
>     So now I have a iterList. I can iterate over it in my struts2 code
> 
> <s:iterate value="iterList" statue="stat">
>     <s:property value="((myClass)dataList.get(stat)).someClassMethod"/>
> <!--first item of dataList ->
> 
>     <s:property value="((myClass)dataList.get(stat+1)).someClassMethod"/>
> <!--second item of dataList ->
> 
> </s:iterate>

You can do this completely within the jsp in a number of ways:

<s:iterator value="%{(dataList.size()).{?(#this%2)==(#this/2)}}" >
</s:iterator>

<s:iterator value="%{datalist}" status="iterStatus">
   <s:if test="#rowstatus.odd == true">
     ...
   </s:if>
   <s:else>
     ...
   </s:else>
</s:iterator>

<s:iterator begin="%{1}" end="%{dataList.size()}" step="%{2}">
</s:iterator>

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: why doesnt iterator tag provide 'next'

Posted by Bhaarat Sharma <bh...@gmail.com>.
cool, Jim, thats a better solution!!

So I'll have something like this to create my iteratorList

int sizeList = dataList.size();
List iterList = new ArrayList();

for (i = 0; i <= sizeList; i=i+2)
{
   iterList.add(i);
}


    So now I have a iterList. I can iterate over it in my struts2 code

<s:iterate value="iterList" statue="stat">
    <s:property value="((myClass)dataList.get(stat)).someClassMethod"/>
<!--first item of dataList ->

    <s:property value="((myClass)dataList.get(stat+1)).someClassMethod"/>
<!--second item of dataList ->

</s:iterate>


Will this work in regards to struts2 html tags?




On Sun, May 31, 2009 at 10:08 AM, Dave Newton <ne...@yahoo.com> wrote:

> Jim Kiley wrote:
>
>> Assuming that you're iterating over a List, why not instead iterate over a
>> List of Integers, and use those Integers as the index to your iterator?
>>  You
>> can increment the counter inside the iterator.  Or if you need to get
>> foo[0]
>> and foo[1] on the first run through, foo[2] and foo[3] on the next run,
>> you
>> could iterate over a List {0, 2, 4, 6, 8...} and get dataList[i] and
>> dataList [i + 1].  It's easy enough to dynamically generate the List of
>> Integers in your action class.
>>
>
> Yep--that was the "just use the index" bit, but I'm grumpy today and didn't
> feel like spelling it out :)
>
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: why doesnt iterator tag provide 'next'

Posted by Dale Newfield <da...@newfield.org>.
Dave Newton wrote:
> Wouldn't mind break or continue, though--I might use those sometimes.

Taking a look at org.apache.struts2.components.IteratorComponent makes 
me think it wouldn't be too tough to add another tag that's only valid 
somewhere inside an iterator that would enable something like the 
following to work:

<table>
   <tr>
     <th>Column 1</th>
     <th>Column 2</th>
     <th>Column 3</th>
   </tr>
   <s:iterator value="%{someList}">
     <tr>
       <td><s:property /></td>
       <s:iterNext>
         <td><s:property /></td>
       </s:iterNext>
       <s:iterNext>
         <td><s:property /></td>
       </s:iterNext>
     </tr>
   </s:iterator>
</table>

That output can otherwise be difficult to construct...

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: why doesnt iterator tag provide 'next'

Posted by Musachy Barroso <mu...@gmail.com>.
yeah, they would be useful.

On Sun, May 31, 2009 at 10:20 AM, Dave Newton <ne...@yahoo.com> wrote:
> Jim Kiley wrote:
>>
>> I figured. The solution to "I can't solve this problem" is rarely "let's
>> add
>> a new tag to the framework."
>
> Wouldn't mind break or continue, though--I might use those sometimes.
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: why doesnt iterator tag provide 'next'

Posted by Dave Newton <ne...@yahoo.com>.
Jim Kiley wrote:
> I figured. The solution to "I can't solve this problem" is rarely "let's add
> a new tag to the framework."

Wouldn't mind break or continue, though--I might use those sometimes.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: why doesnt iterator tag provide 'next'

Posted by Jim Kiley <jh...@summa-tech.com>.
I figured. The solution to "I can't solve this problem" is rarely "let's add
a new tag to the framework."
jk

On Sun, May 31, 2009 at 10:08 AM, Dave Newton <ne...@yahoo.com> wrote:

> Jim Kiley wrote:
>
>> Assuming that you're iterating over a List, why not instead iterate over a
>> List of Integers, and use those Integers as the index to your iterator?
>>  You
>> can increment the counter inside the iterator.  Or if you need to get
>> foo[0]
>> and foo[1] on the first run through, foo[2] and foo[3] on the next run,
>> you
>> could iterate over a List {0, 2, 4, 6, 8...} and get dataList[i] and
>> dataList [i + 1].  It's easy enough to dynamically generate the List of
>> Integers in your action class.
>>
>
> Yep--that was the "just use the index" bit, but I'm grumpy today and didn't
> feel like spelling it out :)
>
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Jim Kiley
Senior Technical Consultant | Summa
[p] 412.258.3346
http://www.summa-tech.com

Re: why doesnt iterator tag provide 'next'

Posted by Dave Newton <ne...@yahoo.com>.
Jim Kiley wrote:
> Assuming that you're iterating over a List, why not instead iterate over a
> List of Integers, and use those Integers as the index to your iterator?  You
> can increment the counter inside the iterator.  Or if you need to get foo[0]
> and foo[1] on the first run through, foo[2] and foo[3] on the next run, you
> could iterate over a List {0, 2, 4, 6, 8...} and get dataList[i] and
> dataList [i + 1].  It's easy enough to dynamically generate the List of
> Integers in your action class.

Yep--that was the "just use the index" bit, but I'm grumpy today and 
didn't feel like spelling it out :)

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: why doesnt iterator tag provide 'next'

Posted by Jim Kiley <jh...@summa-tech.com>.
Assuming that you're iterating over a List, why not instead iterate over a
List of Integers, and use those Integers as the index to your iterator?  You
can increment the counter inside the iterator.  Or if you need to get foo[0]
and foo[1] on the first run through, foo[2] and foo[3] on the next run, you
could iterate over a List {0, 2, 4, 6, 8...} and get dataList[i] and
dataList [i + 1].  It's easy enough to dynamically generate the List of
Integers in your action class.
jk

On Sun, May 31, 2009 at 9:58 AM, Bhaarat Sharma <bh...@gmail.com> wrote:

> sadly in my case i need to :(
>
> But this takes us back, the pseudocode you are suggesting is not possible
> using s:iterate, I dont think we have the ability to move the cursor (or
> current value in top stack) withtin the iterator tag.  Neither does jstl
> provide this.  So sadly, will my code have to sit back in time and use
> scriptlets.
>
> On Sun, May 31, 2009 at 9:49 AM, Dave Newton <ne...@yahoo.com>
> wrote:
>
> > Bhaarat Sharma wrote:
> >
> >> how would 'if' help with 'next'.  can you please give an example?
> >>
> >
> > Pseudocode Java; this is something people should be able to figure out
> for
> > themselves. In JSP I might just use the index.
> >
> > for (Foo curr : foos) {
> >    if (alt) {
> >        ...
> >    } else prev = curr;
> >    alt = !alt;
> > }
> >
> > OTOH, I'd probably never *need* to do this.
> >
> >
> > Dave
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>



-- 
Jim Kiley
Senior Technical Consultant | Summa
[p] 412.258.3346
http://www.summa-tech.com

Re: why doesnt iterator tag provide 'next'

Posted by Dave Newton <ne...@yahoo.com>.
Bhaarat Sharma wrote:
> sadly in my case i need to :(
> 
> But this takes us back, the pseudocode you are suggesting is not possible
> using s:iterate, I dont think we have the ability to move the cursor (or
> current value in top stack) withtin the iterator tag.  Neither does jstl
> provide this.  So sadly, will my code have to sit back in time and use
> scriptlets.

....

Where does my code do anything with the iterator/cursor?

I'll write it out even more:

Foo prev;
boolean alt = false;
for (Foo curr : foos) {
     if (alt) {
         // Do something with prev and curr.
     } else prev = curr;
     alt = !alt;
}

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: why doesnt iterator tag provide 'next'

Posted by Bhaarat Sharma <bh...@gmail.com>.
sadly in my case i need to :(

But this takes us back, the pseudocode you are suggesting is not possible
using s:iterate, I dont think we have the ability to move the cursor (or
current value in top stack) withtin the iterator tag.  Neither does jstl
provide this.  So sadly, will my code have to sit back in time and use
scriptlets.

On Sun, May 31, 2009 at 9:49 AM, Dave Newton <ne...@yahoo.com> wrote:

> Bhaarat Sharma wrote:
>
>> how would 'if' help with 'next'.  can you please give an example?
>>
>
> Pseudocode Java; this is something people should be able to figure out for
> themselves. In JSP I might just use the index.
>
> for (Foo curr : foos) {
>    if (alt) {
>        ...
>    } else prev = curr;
>    alt = !alt;
> }
>
> OTOH, I'd probably never *need* to do this.
>
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: why doesnt iterator tag provide 'next'

Posted by Dave Newton <ne...@yahoo.com>.
Bhaarat Sharma wrote:
> how would 'if' help with 'next'.  can you please give an example?

Pseudocode Java; this is something people should be able to figure out 
for themselves. In JSP I might just use the index.

for (Foo curr : foos) {
     if (alt) {
         ...
     } else prev = curr;
     alt = !alt;
}

OTOH, I'd probably never *need* to do this.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: why doesnt iterator tag provide 'next'

Posted by Bhaarat Sharma <bh...@gmail.com>.
how would 'if' help with 'next'.  can you please give an example?

On Sun, May 31, 2009 at 12:58 AM, Musachy Barroso <mu...@gmail.com> wrote:

> duh..I sometimes read the whole email, believe me :). I have had a
> couple of scenarios where break would be nice, but I always go around
> it using "if", same thing for "next", just more often.
>
> musachy
>
> On Sat, May 30, 2009 at 8:10 PM, Bhaarat Sharma <bh...@gmail.com>
> wrote:
> > Musachy,
> >
> > I think you have the wrong impression.
> >
> > This is not a 'break' tag...this would work same as in iterator tag BUT
> > would also have a functionality where the user can go to the next element
> > within the iteration.
> >
> > Thanks
> >
> > On Sat, May 30, 2009 at 11:46 AM, Musachy Barroso <mu...@gmail.com>
> wrote:
> >
> >> I will take a look at it when I have a chance, this would be very easy
> >> to implement.
> >>
> >> musachy
> >>
> >> On Sat, May 30, 2009 at 11:45 AM, Musachy Barroso <mu...@gmail.com>
> >> wrote:
> >> > I would suggest you to write a new tag, as a patch to struts core
> >> > (look at the other tags, all you need is 2 classes and a couple of
> >> > annotations). What this "break" tag would need to do is find the
> >> > parent "iterator" tag, and somehow let it know that the iteration is
> >> > over.
> >> >
> >> > musachy
> >> >
> >> > On Sat, May 30, 2009 at 10:51 AM, Martin Gainty <mg...@hotmail.com>
> >> wrote:
> >> >>
> >> >> Bharaat
> >> >>
> >> >> did you get a change to read musachy's tag developer guide
> >> >> http://struts.apache.org/2.0.14/docs/tag-developers-guide.html
> >> >>
> >> >> ?
> >> >> Martin Gainty
> >> >> ______________________________________________
> >> >> Verzicht und Vertraulichkeitanmerkung/Note de déni et de
> confidentialité
> >> >>
> >> >> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> >> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede
> unbefugte
> >> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese
> Nachricht
> >> dient lediglich dem Austausch von Informationen und entfaltet keine
> >> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> >> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> >> >> Ce message est confidentiel et peut être privilégié. Si vous n'êtes
> pas
> >> le destinataire prévu, nous te demandons avec bonté que pour satisfaire
> >> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la
> copie
> >> de ceci est interdite. Ce message sert à l'information seulement et
> n'aura
> >> pas n'importe quel effet légalement obligatoire. Étant donné que les
> email
> >> peuvent facilement être sujets à la manipulation, nous ne pouvons
> accepter
> >> aucune responsabilité pour le contenu fourni.
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>> Date: Sat, 30 May 2009 08:51:17 -0400
> >> >>> Subject: Re: why doesnt iterator tag provide 'next'
> >> >>> From: bhaarat.s@gmail.com
> >> >>> To: user@struts.apache.org
> >> >>>
> >> >>> I actually would like to make a custom tag out of this as I think it
> >> might
> >> >>> be helpful to others as well.  However, I cant find any good
> >> documentation
> >> >>> on how to create one.  I have 'Struts2 web 2.0 projects' book by Ian
> >> Roughly
> >> >>> and it does not show how to create your own custom tags.
> >> >>>
> >> >>> I believe If I were to create a custom tag for this I will take most
> of
> >> the
> >> >>> code from the iterator tag and just add a few bits to it?
> >> >>>
> >> >>> Can someone please just exaplain some steps that are involved in
> making
> >> a
> >> >>> custom tag?
> >> >>>
> >> >>> Thanks
> >> >>> -bhaarat
> >> >>>
> >> >>> On Sat, May 30, 2009 at 8:00 AM, Martin Gainty <mgainty@hotmail.com
> >
> >> wrote:
> >> >>>
> >> >>> >
> >> >>> > Good Morning Bharaat
> >> >>> >
> >> >>> > struts tags have an extensible design which can be expanded for
> >> future
> >> >>> > requirements
> >> >>> > can you suggest a testcase to implement this functionality?
> >> >>> >
> >> >>> > thanks,
> >> >>> > Martin Gainty
> >> >>> > ______________________________________________
> >> >>> > Verzicht und Vertraulichkeitanmerkung/Note de déni et de
> >> confidentialité
> >> >>> >
> >> >>> > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> >> >>> > Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede
> >> unbefugte
> >> >>> > Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese
> >> Nachricht
> >> >>> > dient lediglich dem Austausch von Informationen und entfaltet
> keine
> >> >>> > rechtliche Bindungswirkung. Aufgrund der leichten
> Manipulierbarkeit
> >> von
> >> >>> > E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> >> >>> > Ce message est confidentiel et peut être privilégié. Si vous
> n'êtes
> >> pas le
> >> >>> > destinataire prévu, nous te demandons avec bonté que pour
> satisfaire
> >> >>> > informez l'expéditeur. N'importe quelle diffusion non autorisée ou
> la
> >> copie
> >> >>> > de ceci est interdite. Ce message sert à l'information seulement
> et
> >> n'aura
> >> >>> > pas n'importe quel effet légalement obligatoire. Étant donné que
> les
> >> email
> >> >>> > peuvent facilement être sujets à la manipulation, nous ne pouvons
> >> accepter
> >> >>> > aucune responsabilité pour le contenu fourni.
> >> >>> >
> >> >>> >
> >> >>> >
> >> >>> >
> >> >>> > > Date: Sat, 30 May 2009 00:25:16 -0400
> >> >>> > > From: newton.dave@yahoo.com
> >> >>> > > To: user@struts.apache.org
> >> >>> > > Subject: Re: why doesnt iterator tag provide 'next'
> >> >>> > >
> >> >>> > > Bhaarat Sharma wrote:
> >> >>> > > > Iterator it = myList.iterator()
> >> >>> > > > while (it.hasNext()) {
> >> >>> > > >     SomeClass ob1 = (SomeClass) it.next();
> >> >>> > > >     SomeClass ob2 = (SomeClass) it.next();
> >> >>> > > >     //do something
> >> >>> > > > }
> >> >>> > > >
> >> >>> > > > why can we not achieve the same with s:iterator tag.
> >> >>> > > > What was the reasoning behind not providing a 'next' or
> something
> >> >>> > similar?
> >> >>> > >
> >> >>> > > Because it's a simple iterator, just like Java's for (Type var :
> >> >>> > > collection) construct or JSTL's forEach tag.
> >> >>> > >
> >> >>> > > Dave
> >> >>> > >
> >> >>> > >
> >> ---------------------------------------------------------------------
> >> >>> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> >>> > > For additional commands, e-mail: user-help@struts.apache.org
> >> >>> > >
> >> >>> >
> >> >>> > _________________________________________________________________
> >> >>> > Insert movie times and more without leaving Hotmail®.
> >> >>> >
> >> >>> >
> >>
> http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009
> >> >>> >
> >> >>
> >> >> _________________________________________________________________
> >> >> Insert movie times and more without leaving Hotmail®.
> >> >>
> >>
> http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009
> >> >
> >> >
> >> >
> >> > --
> >> > "Hey you! Would you help me to carry the stone?" Pink Floyd
> >> >
> >>
> >>
> >>
> >> --
> >> "Hey you! Would you help me to carry the stone?" Pink Floyd
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: why doesnt iterator tag provide 'next'

Posted by Musachy Barroso <mu...@gmail.com>.
duh..I sometimes read the whole email, believe me :). I have had a
couple of scenarios where break would be nice, but I always go around
it using "if", same thing for "next", just more often.

musachy

On Sat, May 30, 2009 at 8:10 PM, Bhaarat Sharma <bh...@gmail.com> wrote:
> Musachy,
>
> I think you have the wrong impression.
>
> This is not a 'break' tag...this would work same as in iterator tag BUT
> would also have a functionality where the user can go to the next element
> within the iteration.
>
> Thanks
>
> On Sat, May 30, 2009 at 11:46 AM, Musachy Barroso <mu...@gmail.com> wrote:
>
>> I will take a look at it when I have a chance, this would be very easy
>> to implement.
>>
>> musachy
>>
>> On Sat, May 30, 2009 at 11:45 AM, Musachy Barroso <mu...@gmail.com>
>> wrote:
>> > I would suggest you to write a new tag, as a patch to struts core
>> > (look at the other tags, all you need is 2 classes and a couple of
>> > annotations). What this "break" tag would need to do is find the
>> > parent "iterator" tag, and somehow let it know that the iteration is
>> > over.
>> >
>> > musachy
>> >
>> > On Sat, May 30, 2009 at 10:51 AM, Martin Gainty <mg...@hotmail.com>
>> wrote:
>> >>
>> >> Bharaat
>> >>
>> >> did you get a change to read musachy's tag developer guide
>> >> http://struts.apache.org/2.0.14/docs/tag-developers-guide.html
>> >>
>> >> ?
>> >> Martin Gainty
>> >> ______________________________________________
>> >> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>> >>
>> >> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
>> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
>> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
>> dient lediglich dem Austausch von Informationen und entfaltet keine
>> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
>> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
>> >> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas
>> le destinataire prévu, nous te demandons avec bonté que pour satisfaire
>> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
>> de ceci est interdite. Ce message sert à l'information seulement et n'aura
>> pas n'importe quel effet légalement obligatoire. Étant donné que les email
>> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
>> aucune responsabilité pour le contenu fourni.
>> >>
>> >>
>> >>
>> >>
>> >>> Date: Sat, 30 May 2009 08:51:17 -0400
>> >>> Subject: Re: why doesnt iterator tag provide 'next'
>> >>> From: bhaarat.s@gmail.com
>> >>> To: user@struts.apache.org
>> >>>
>> >>> I actually would like to make a custom tag out of this as I think it
>> might
>> >>> be helpful to others as well.  However, I cant find any good
>> documentation
>> >>> on how to create one.  I have 'Struts2 web 2.0 projects' book by Ian
>> Roughly
>> >>> and it does not show how to create your own custom tags.
>> >>>
>> >>> I believe If I were to create a custom tag for this I will take most of
>> the
>> >>> code from the iterator tag and just add a few bits to it?
>> >>>
>> >>> Can someone please just exaplain some steps that are involved in making
>> a
>> >>> custom tag?
>> >>>
>> >>> Thanks
>> >>> -bhaarat
>> >>>
>> >>> On Sat, May 30, 2009 at 8:00 AM, Martin Gainty <mg...@hotmail.com>
>> wrote:
>> >>>
>> >>> >
>> >>> > Good Morning Bharaat
>> >>> >
>> >>> > struts tags have an extensible design which can be expanded for
>> future
>> >>> > requirements
>> >>> > can you suggest a testcase to implement this functionality?
>> >>> >
>> >>> > thanks,
>> >>> > Martin Gainty
>> >>> > ______________________________________________
>> >>> > Verzicht und Vertraulichkeitanmerkung/Note de déni et de
>> confidentialité
>> >>> >
>> >>> > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
>> >>> > Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede
>> unbefugte
>> >>> > Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese
>> Nachricht
>> >>> > dient lediglich dem Austausch von Informationen und entfaltet keine
>> >>> > rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit
>> von
>> >>> > E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
>> >>> > Ce message est confidentiel et peut être privilégié. Si vous n'êtes
>> pas le
>> >>> > destinataire prévu, nous te demandons avec bonté que pour satisfaire
>> >>> > informez l'expéditeur. N'importe quelle diffusion non autorisée ou la
>> copie
>> >>> > de ceci est interdite. Ce message sert à l'information seulement et
>> n'aura
>> >>> > pas n'importe quel effet légalement obligatoire. Étant donné que les
>> email
>> >>> > peuvent facilement être sujets à la manipulation, nous ne pouvons
>> accepter
>> >>> > aucune responsabilité pour le contenu fourni.
>> >>> >
>> >>> >
>> >>> >
>> >>> >
>> >>> > > Date: Sat, 30 May 2009 00:25:16 -0400
>> >>> > > From: newton.dave@yahoo.com
>> >>> > > To: user@struts.apache.org
>> >>> > > Subject: Re: why doesnt iterator tag provide 'next'
>> >>> > >
>> >>> > > Bhaarat Sharma wrote:
>> >>> > > > Iterator it = myList.iterator()
>> >>> > > > while (it.hasNext()) {
>> >>> > > >     SomeClass ob1 = (SomeClass) it.next();
>> >>> > > >     SomeClass ob2 = (SomeClass) it.next();
>> >>> > > >     //do something
>> >>> > > > }
>> >>> > > >
>> >>> > > > why can we not achieve the same with s:iterator tag.
>> >>> > > > What was the reasoning behind not providing a 'next' or something
>> >>> > similar?
>> >>> > >
>> >>> > > Because it's a simple iterator, just like Java's for (Type var :
>> >>> > > collection) construct or JSTL's forEach tag.
>> >>> > >
>> >>> > > Dave
>> >>> > >
>> >>> > >
>> ---------------------------------------------------------------------
>> >>> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> >>> > > For additional commands, e-mail: user-help@struts.apache.org
>> >>> > >
>> >>> >
>> >>> > _________________________________________________________________
>> >>> > Insert movie times and more without leaving Hotmail®.
>> >>> >
>> >>> >
>> http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009
>> >>> >
>> >>
>> >> _________________________________________________________________
>> >> Insert movie times and more without leaving Hotmail®.
>> >>
>> http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009
>> >
>> >
>> >
>> > --
>> > "Hey you! Would you help me to carry the stone?" Pink Floyd
>> >
>>
>>
>>
>> --
>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: why doesnt iterator tag provide 'next'

Posted by Bhaarat Sharma <bh...@gmail.com>.
Musachy,

I think you have the wrong impression.

This is not a 'break' tag...this would work same as in iterator tag BUT
would also have a functionality where the user can go to the next element
within the iteration.

Thanks

On Sat, May 30, 2009 at 11:46 AM, Musachy Barroso <mu...@gmail.com> wrote:

> I will take a look at it when I have a chance, this would be very easy
> to implement.
>
> musachy
>
> On Sat, May 30, 2009 at 11:45 AM, Musachy Barroso <mu...@gmail.com>
> wrote:
> > I would suggest you to write a new tag, as a patch to struts core
> > (look at the other tags, all you need is 2 classes and a couple of
> > annotations). What this "break" tag would need to do is find the
> > parent "iterator" tag, and somehow let it know that the iteration is
> > over.
> >
> > musachy
> >
> > On Sat, May 30, 2009 at 10:51 AM, Martin Gainty <mg...@hotmail.com>
> wrote:
> >>
> >> Bharaat
> >>
> >> did you get a change to read musachy's tag developer guide
> >> http://struts.apache.org/2.0.14/docs/tag-developers-guide.html
> >>
> >> ?
> >> Martin Gainty
> >> ______________________________________________
> >> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
> >>
> >> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
> dient lediglich dem Austausch von Informationen und entfaltet keine
> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> >> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas
> le destinataire prévu, nous te demandons avec bonté que pour satisfaire
> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
> de ceci est interdite. Ce message sert à l'information seulement et n'aura
> pas n'importe quel effet légalement obligatoire. Étant donné que les email
> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
> aucune responsabilité pour le contenu fourni.
> >>
> >>
> >>
> >>
> >>> Date: Sat, 30 May 2009 08:51:17 -0400
> >>> Subject: Re: why doesnt iterator tag provide 'next'
> >>> From: bhaarat.s@gmail.com
> >>> To: user@struts.apache.org
> >>>
> >>> I actually would like to make a custom tag out of this as I think it
> might
> >>> be helpful to others as well.  However, I cant find any good
> documentation
> >>> on how to create one.  I have 'Struts2 web 2.0 projects' book by Ian
> Roughly
> >>> and it does not show how to create your own custom tags.
> >>>
> >>> I believe If I were to create a custom tag for this I will take most of
> the
> >>> code from the iterator tag and just add a few bits to it?
> >>>
> >>> Can someone please just exaplain some steps that are involved in making
> a
> >>> custom tag?
> >>>
> >>> Thanks
> >>> -bhaarat
> >>>
> >>> On Sat, May 30, 2009 at 8:00 AM, Martin Gainty <mg...@hotmail.com>
> wrote:
> >>>
> >>> >
> >>> > Good Morning Bharaat
> >>> >
> >>> > struts tags have an extensible design which can be expanded for
> future
> >>> > requirements
> >>> > can you suggest a testcase to implement this functionality?
> >>> >
> >>> > thanks,
> >>> > Martin Gainty
> >>> > ______________________________________________
> >>> > Verzicht und Vertraulichkeitanmerkung/Note de déni et de
> confidentialité
> >>> >
> >>> > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> >>> > Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede
> unbefugte
> >>> > Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese
> Nachricht
> >>> > dient lediglich dem Austausch von Informationen und entfaltet keine
> >>> > rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit
> von
> >>> > E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> >>> > Ce message est confidentiel et peut être privilégié. Si vous n'êtes
> pas le
> >>> > destinataire prévu, nous te demandons avec bonté que pour satisfaire
> >>> > informez l'expéditeur. N'importe quelle diffusion non autorisée ou la
> copie
> >>> > de ceci est interdite. Ce message sert à l'information seulement et
> n'aura
> >>> > pas n'importe quel effet légalement obligatoire. Étant donné que les
> email
> >>> > peuvent facilement être sujets à la manipulation, nous ne pouvons
> accepter
> >>> > aucune responsabilité pour le contenu fourni.
> >>> >
> >>> >
> >>> >
> >>> >
> >>> > > Date: Sat, 30 May 2009 00:25:16 -0400
> >>> > > From: newton.dave@yahoo.com
> >>> > > To: user@struts.apache.org
> >>> > > Subject: Re: why doesnt iterator tag provide 'next'
> >>> > >
> >>> > > Bhaarat Sharma wrote:
> >>> > > > Iterator it = myList.iterator()
> >>> > > > while (it.hasNext()) {
> >>> > > >     SomeClass ob1 = (SomeClass) it.next();
> >>> > > >     SomeClass ob2 = (SomeClass) it.next();
> >>> > > >     //do something
> >>> > > > }
> >>> > > >
> >>> > > > why can we not achieve the same with s:iterator tag.
> >>> > > > What was the reasoning behind not providing a 'next' or something
> >>> > similar?
> >>> > >
> >>> > > Because it's a simple iterator, just like Java's for (Type var :
> >>> > > collection) construct or JSTL's forEach tag.
> >>> > >
> >>> > > Dave
> >>> > >
> >>> > >
> ---------------------------------------------------------------------
> >>> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >>> > > For additional commands, e-mail: user-help@struts.apache.org
> >>> > >
> >>> >
> >>> > _________________________________________________________________
> >>> > Insert movie times and more without leaving Hotmail®.
> >>> >
> >>> >
> http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009
> >>> >
> >>
> >> _________________________________________________________________
> >> Insert movie times and more without leaving Hotmail®.
> >>
> http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009
> >
> >
> >
> > --
> > "Hey you! Would you help me to carry the stone?" Pink Floyd
> >
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: why doesnt iterator tag provide 'next'

Posted by Musachy Barroso <mu...@gmail.com>.
I will take a look at it when I have a chance, this would be very easy
to implement.

musachy

On Sat, May 30, 2009 at 11:45 AM, Musachy Barroso <mu...@gmail.com> wrote:
> I would suggest you to write a new tag, as a patch to struts core
> (look at the other tags, all you need is 2 classes and a couple of
> annotations). What this "break" tag would need to do is find the
> parent "iterator" tag, and somehow let it know that the iteration is
> over.
>
> musachy
>
> On Sat, May 30, 2009 at 10:51 AM, Martin Gainty <mg...@hotmail.com> wrote:
>>
>> Bharaat
>>
>> did you get a change to read musachy's tag developer guide
>> http://struts.apache.org/2.0.14/docs/tag-developers-guide.html
>>
>> ?
>> Martin Gainty
>> ______________________________________________
>> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>>
>> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
>> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.
>>
>>
>>
>>
>>> Date: Sat, 30 May 2009 08:51:17 -0400
>>> Subject: Re: why doesnt iterator tag provide 'next'
>>> From: bhaarat.s@gmail.com
>>> To: user@struts.apache.org
>>>
>>> I actually would like to make a custom tag out of this as I think it might
>>> be helpful to others as well.  However, I cant find any good documentation
>>> on how to create one.  I have 'Struts2 web 2.0 projects' book by Ian Roughly
>>> and it does not show how to create your own custom tags.
>>>
>>> I believe If I were to create a custom tag for this I will take most of the
>>> code from the iterator tag and just add a few bits to it?
>>>
>>> Can someone please just exaplain some steps that are involved in making a
>>> custom tag?
>>>
>>> Thanks
>>> -bhaarat
>>>
>>> On Sat, May 30, 2009 at 8:00 AM, Martin Gainty <mg...@hotmail.com> wrote:
>>>
>>> >
>>> > Good Morning Bharaat
>>> >
>>> > struts tags have an extensible design which can be expanded for future
>>> > requirements
>>> > can you suggest a testcase to implement this functionality?
>>> >
>>> > thanks,
>>> > Martin Gainty
>>> > ______________________________________________
>>> > Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>>> >
>>> > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
>>> > Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
>>> > Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
>>> > dient lediglich dem Austausch von Informationen und entfaltet keine
>>> > rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
>>> > E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
>>> > Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
>>> > destinataire prévu, nous te demandons avec bonté que pour satisfaire
>>> > informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
>>> > de ceci est interdite. Ce message sert à l'information seulement et n'aura
>>> > pas n'importe quel effet légalement obligatoire. Étant donné que les email
>>> > peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
>>> > aucune responsabilité pour le contenu fourni.
>>> >
>>> >
>>> >
>>> >
>>> > > Date: Sat, 30 May 2009 00:25:16 -0400
>>> > > From: newton.dave@yahoo.com
>>> > > To: user@struts.apache.org
>>> > > Subject: Re: why doesnt iterator tag provide 'next'
>>> > >
>>> > > Bhaarat Sharma wrote:
>>> > > > Iterator it = myList.iterator()
>>> > > > while (it.hasNext()) {
>>> > > >     SomeClass ob1 = (SomeClass) it.next();
>>> > > >     SomeClass ob2 = (SomeClass) it.next();
>>> > > >     //do something
>>> > > > }
>>> > > >
>>> > > > why can we not achieve the same with s:iterator tag.
>>> > > > What was the reasoning behind not providing a 'next' or something
>>> > similar?
>>> > >
>>> > > Because it's a simple iterator, just like Java's for (Type var :
>>> > > collection) construct or JSTL's forEach tag.
>>> > >
>>> > > Dave
>>> > >
>>> > > ---------------------------------------------------------------------
>>> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> > > For additional commands, e-mail: user-help@struts.apache.org
>>> > >
>>> >
>>> > _________________________________________________________________
>>> > Insert movie times and more without leaving Hotmail®.
>>> >
>>> > http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009
>>> >
>>
>> _________________________________________________________________
>> Insert movie times and more without leaving Hotmail®.
>> http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: why doesnt iterator tag provide 'next'

Posted by Musachy Barroso <mu...@gmail.com>.
I would suggest you to write a new tag, as a patch to struts core
(look at the other tags, all you need is 2 classes and a couple of
annotations). What this "break" tag would need to do is find the
parent "iterator" tag, and somehow let it know that the iteration is
over.

musachy

On Sat, May 30, 2009 at 10:51 AM, Martin Gainty <mg...@hotmail.com> wrote:
>
> Bharaat
>
> did you get a change to read musachy's tag developer guide
> http://struts.apache.org/2.0.14/docs/tag-developers-guide.html
>
> ?
> Martin Gainty
> ______________________________________________
> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.
>
>
>
>
>> Date: Sat, 30 May 2009 08:51:17 -0400
>> Subject: Re: why doesnt iterator tag provide 'next'
>> From: bhaarat.s@gmail.com
>> To: user@struts.apache.org
>>
>> I actually would like to make a custom tag out of this as I think it might
>> be helpful to others as well.  However, I cant find any good documentation
>> on how to create one.  I have 'Struts2 web 2.0 projects' book by Ian Roughly
>> and it does not show how to create your own custom tags.
>>
>> I believe If I were to create a custom tag for this I will take most of the
>> code from the iterator tag and just add a few bits to it?
>>
>> Can someone please just exaplain some steps that are involved in making a
>> custom tag?
>>
>> Thanks
>> -bhaarat
>>
>> On Sat, May 30, 2009 at 8:00 AM, Martin Gainty <mg...@hotmail.com> wrote:
>>
>> >
>> > Good Morning Bharaat
>> >
>> > struts tags have an extensible design which can be expanded for future
>> > requirements
>> > can you suggest a testcase to implement this functionality?
>> >
>> > thanks,
>> > Martin Gainty
>> > ______________________________________________
>> > Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>> >
>> > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
>> > Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
>> > Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
>> > dient lediglich dem Austausch von Informationen und entfaltet keine
>> > rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
>> > E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
>> > Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
>> > destinataire prévu, nous te demandons avec bonté que pour satisfaire
>> > informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
>> > de ceci est interdite. Ce message sert à l'information seulement et n'aura
>> > pas n'importe quel effet légalement obligatoire. Étant donné que les email
>> > peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
>> > aucune responsabilité pour le contenu fourni.
>> >
>> >
>> >
>> >
>> > > Date: Sat, 30 May 2009 00:25:16 -0400
>> > > From: newton.dave@yahoo.com
>> > > To: user@struts.apache.org
>> > > Subject: Re: why doesnt iterator tag provide 'next'
>> > >
>> > > Bhaarat Sharma wrote:
>> > > > Iterator it = myList.iterator()
>> > > > while (it.hasNext()) {
>> > > >     SomeClass ob1 = (SomeClass) it.next();
>> > > >     SomeClass ob2 = (SomeClass) it.next();
>> > > >     //do something
>> > > > }
>> > > >
>> > > > why can we not achieve the same with s:iterator tag.
>> > > > What was the reasoning behind not providing a 'next' or something
>> > similar?
>> > >
>> > > Because it's a simple iterator, just like Java's for (Type var :
>> > > collection) construct or JSTL's forEach tag.
>> > >
>> > > Dave
>> > >
>> > > ---------------------------------------------------------------------
>> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> > > For additional commands, e-mail: user-help@struts.apache.org
>> > >
>> >
>> > _________________________________________________________________
>> > Insert movie times and more without leaving Hotmail®.
>> >
>> > http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009
>> >
>
> _________________________________________________________________
> Insert movie times and more without leaving Hotmail®.
> http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: why doesnt iterator tag provide 'next'

Posted by Martin Gainty <mg...@hotmail.com>.
Bharaat

did you get a change to read musachy's tag developer guide
http://struts.apache.org/2.0.14/docs/tag-developers-guide.html

?
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> Date: Sat, 30 May 2009 08:51:17 -0400
> Subject: Re: why doesnt iterator tag provide 'next'
> From: bhaarat.s@gmail.com
> To: user@struts.apache.org
> 
> I actually would like to make a custom tag out of this as I think it might
> be helpful to others as well.  However, I cant find any good documentation
> on how to create one.  I have 'Struts2 web 2.0 projects' book by Ian Roughly
> and it does not show how to create your own custom tags.
> 
> I believe If I were to create a custom tag for this I will take most of the
> code from the iterator tag and just add a few bits to it?
> 
> Can someone please just exaplain some steps that are involved in making a
> custom tag?
> 
> Thanks
> -bhaarat
> 
> On Sat, May 30, 2009 at 8:00 AM, Martin Gainty <mg...@hotmail.com> wrote:
> 
> >
> > Good Morning Bharaat
> >
> > struts tags have an extensible design which can be expanded for future
> > requirements
> > can you suggest a testcase to implement this functionality?
> >
> > thanks,
> > Martin Gainty
> > ______________________________________________
> > Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
> >
> > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> > Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
> > Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
> > dient lediglich dem Austausch von Informationen und entfaltet keine
> > rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> > E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> > Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
> > destinataire prévu, nous te demandons avec bonté que pour satisfaire
> > informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
> > de ceci est interdite. Ce message sert à l'information seulement et n'aura
> > pas n'importe quel effet légalement obligatoire. Étant donné que les email
> > peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
> > aucune responsabilité pour le contenu fourni.
> >
> >
> >
> >
> > > Date: Sat, 30 May 2009 00:25:16 -0400
> > > From: newton.dave@yahoo.com
> > > To: user@struts.apache.org
> > > Subject: Re: why doesnt iterator tag provide 'next'
> > >
> > > Bhaarat Sharma wrote:
> > > > Iterator it = myList.iterator()
> > > > while (it.hasNext()) {
> > > >     SomeClass ob1 = (SomeClass) it.next();
> > > >     SomeClass ob2 = (SomeClass) it.next();
> > > >     //do something
> > > > }
> > > >
> > > > why can we not achieve the same with s:iterator tag.
> > > > What was the reasoning behind not providing a 'next' or something
> > similar?
> > >
> > > Because it's a simple iterator, just like Java's for (Type var :
> > > collection) construct or JSTL's forEach tag.
> > >
> > > Dave
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > >
> >
> > _________________________________________________________________
> > Insert movie times and more without leaving Hotmail®.
> >
> > http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009
> >

_________________________________________________________________
Insert movie times and more without leaving Hotmail®.
http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009

Re: why doesnt iterator tag provide 'next'

Posted by Bhaarat Sharma <bh...@gmail.com>.
I actually would like to make a custom tag out of this as I think it might
be helpful to others as well.  However, I cant find any good documentation
on how to create one.  I have 'Struts2 web 2.0 projects' book by Ian Roughly
and it does not show how to create your own custom tags.

I believe If I were to create a custom tag for this I will take most of the
code from the iterator tag and just add a few bits to it?

Can someone please just exaplain some steps that are involved in making a
custom tag?

Thanks
-bhaarat

On Sat, May 30, 2009 at 8:00 AM, Martin Gainty <mg...@hotmail.com> wrote:

>
> Good Morning Bharaat
>
> struts tags have an extensible design which can be expanded for future
> requirements
> can you suggest a testcase to implement this functionality?
>
> thanks,
> Martin Gainty
> ______________________________________________
> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
> dient lediglich dem Austausch von Informationen und entfaltet keine
> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
> destinataire prévu, nous te demandons avec bonté que pour satisfaire
> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
> de ceci est interdite. Ce message sert à l'information seulement et n'aura
> pas n'importe quel effet légalement obligatoire. Étant donné que les email
> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
> aucune responsabilité pour le contenu fourni.
>
>
>
>
> > Date: Sat, 30 May 2009 00:25:16 -0400
> > From: newton.dave@yahoo.com
> > To: user@struts.apache.org
> > Subject: Re: why doesnt iterator tag provide 'next'
> >
> > Bhaarat Sharma wrote:
> > > Iterator it = myList.iterator()
> > > while (it.hasNext()) {
> > >     SomeClass ob1 = (SomeClass) it.next();
> > >     SomeClass ob2 = (SomeClass) it.next();
> > >     //do something
> > > }
> > >
> > > why can we not achieve the same with s:iterator tag.
> > > What was the reasoning behind not providing a 'next' or something
> similar?
> >
> > Because it's a simple iterator, just like Java's for (Type var :
> > collection) construct or JSTL's forEach tag.
> >
> > Dave
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
>
> _________________________________________________________________
> Insert movie times and more without leaving Hotmail®.
>
> http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009
>

RE: why doesnt iterator tag provide 'next'

Posted by Martin Gainty <mg...@hotmail.com>.
Good Morning Bharaat

struts tags have an extensible design which can be expanded for future requirements
can you suggest a testcase to implement this functionality?

thanks,
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> Date: Sat, 30 May 2009 00:25:16 -0400
> From: newton.dave@yahoo.com
> To: user@struts.apache.org
> Subject: Re: why doesnt iterator tag provide 'next'
> 
> Bhaarat Sharma wrote:
> > Iterator it = myList.iterator()
> > while (it.hasNext()) {
> >     SomeClass ob1 = (SomeClass) it.next();
> >     SomeClass ob2 = (SomeClass) it.next();
> >     //do something
> > }
> > 
> > why can we not achieve the same with s:iterator tag.
> > What was the reasoning behind not providing a 'next' or something similar?
> 
> Because it's a simple iterator, just like Java's for (Type var : 
> collection) construct or JSTL's forEach tag.
> 
> Dave
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

_________________________________________________________________
Insert movie times and more without leaving Hotmail®.
http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009

Re: why doesnt iterator tag provide 'next'

Posted by Chris Pratt <th...@gmail.com>.
I wouldn't put Java in my HTML any more than I would use println statements
in a Servlet to generate HTML.  Scriplets are dead and should be left to
rest in peace.

If you can't find a way to do what you need with either the JSTL or Struts
taglibs, I would suggest writing your own custom tag, it's fairly
straightforward and totally reusable (unlike a Scriplet).
  (*Chris*)

On Fri, May 29, 2009 at 10:33 PM, Bhaarat Sharma <bh...@gmail.com>wrote:

> so if there is a need to do something like this ...we are better off using
> good ole scritplets? <% %>
>
> On Sat, May 30, 2009 at 12:25 AM, Dave Newton <ne...@yahoo.com>
> wrote:
>
> > Bhaarat Sharma wrote:
> >
> >> Iterator it = myList.iterator()
> >> while (it.hasNext()) {
> >>    SomeClass ob1 = (SomeClass) it.next();
> >>    SomeClass ob2 = (SomeClass) it.next();
> >>    //do something
> >> }
> >>
> >> why can we not achieve the same with s:iterator tag.
> >> What was the reasoning behind not providing a 'next' or something
> similar?
> >>
> >
> > Because it's a simple iterator, just like Java's for (Type var :
> > collection) construct or JSTL's forEach tag.
> >
> > Dave
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>

Re: why doesnt iterator tag provide 'next'

Posted by Bhaarat Sharma <bh...@gmail.com>.
so if there is a need to do something like this ...we are better off using
good ole scritplets? <% %>

On Sat, May 30, 2009 at 12:25 AM, Dave Newton <ne...@yahoo.com> wrote:

> Bhaarat Sharma wrote:
>
>> Iterator it = myList.iterator()
>> while (it.hasNext()) {
>>    SomeClass ob1 = (SomeClass) it.next();
>>    SomeClass ob2 = (SomeClass) it.next();
>>    //do something
>> }
>>
>> why can we not achieve the same with s:iterator tag.
>> What was the reasoning behind not providing a 'next' or something similar?
>>
>
> Because it's a simple iterator, just like Java's for (Type var :
> collection) construct or JSTL's forEach tag.
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: why doesnt iterator tag provide 'next'

Posted by Dave Newton <ne...@yahoo.com>.
Bhaarat Sharma wrote:
> Iterator it = myList.iterator()
> while (it.hasNext()) {
>     SomeClass ob1 = (SomeClass) it.next();
>     SomeClass ob2 = (SomeClass) it.next();
>     //do something
> }
> 
> why can we not achieve the same with s:iterator tag.
> What was the reasoning behind not providing a 'next' or something similar?

Because it's a simple iterator, just like Java's for (Type var : 
collection) construct or JSTL's forEach tag.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org