s:iterator ¿begin -> end?

View: New views
12 Messages — Rating Filter:   Alert me  

s:iterator ¿begin -> end?

by Ignacio de Córdoba :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there,
I've checked struts2 docs and this forum and have found no inside syntax for s:iterator tag to do:
<c:forEach var='' value='${}' being='1' end='4'/>

Examples in docs just show how to count from 1 to 5 ¿? I'd like to avoid counting and using indexed property to access an iterator. The last example in docs doesnt seem to work if I replace "this" with the property/objet I want to iterate.

I am sure struts2 team has thought of a way to do some partial iterator (I can also do the full iterator and do a s:if to show only 5 values using status.index, but doesn't seem a nice solution.

Thanks,
Ignacio

Re: s:iterator ¿begin -> end?

by newton.dave :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ignacio de Córdoba wrote:

> Hi there,
> I've checked struts2 docs and this forum and have found no inside syntax for
> s:iterator tag to do:
> <c:forEach var='' value='${}' being='1' end='4'/>
>
> Examples in docs just show how to count from 1 to 5 ¿? I'd like to avoid
> counting and using indexed property to access an iterator. The last example
> in docs doesnt seem to work if I replace "this" with the property/objet I
> want to iterate.
>
> I am sure struts2 team has thought of a way to do some partial iterator (I
> can also do the full iterator and do a s:if to show only 5 values using
> status.index, but doesn't seem a nice solution.

Any reason you can't use <c:forEach...>? <s:iterator doesn't have the
same functionality.

Dave


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


Re: s:iterator ¿begin -> end?

by Ignacio de Córdoba :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
thanks for your reply.
Well... I have to iterate through a collection accesible in a struts2 Action. I can make that object visible to the page/request scope and then access it from JSTL <c:forEach>; in fact I am doing that for dynamic images as strugs2 has no IMG tag to use OGNL directly. Very painful when someone is used to access the object from the tag itself. Moreover... I am really trying to forget about EL and JSTL. I really don't find my self confortable using 3 different expression languages / tag libs in my pages. I didn't have to (in struts1) but maybe I have to accept that idea now.
Moreover, EL is obsolete when compared to OGNL (oh god... when I discovered I could do #{people.size()} I just didn't believe it!!! Direct access to methods. JSTL hasn't been improved for 4 (5?) years! Method access, valuestack... and I am new to OGNL. Don't know 50% of its power!

More situations: I made my HTML designers learn JSTL. Now I have to make them learn OGNL and I am sure they'll have problems with both things mixed. Of course, I'd like new people in the company thinking about the presentation layer just to handle one thing.

Why doesn't OGNL team focus on making it possible to forget about JSTL+EL and just use OGNL for every thing? It nearly does!!!! and just because a couple of minor glitches we can't. (Another example... s:a tag doesn't have "target" attribute. I have then to use HTML  tag directly, what forces me to transfer the href data in the Action to an object in the page scope and use EL where. Painful for something that should be straightforward.

Well... sorry for the long text. Please don't take me wrong. Just love struts2 and would love to forget about old technnologies. I wish I had time and knowledge to help on all this. Now I just can't.

newton.dave wrote:
Ignacio de Córdoba wrote:
> Hi there,
> I've checked struts2 docs and this forum and have found no inside syntax for
> s:iterator tag to do:
> <c:forEach var='' value='${}' being='1' end='4'/>
>
> Examples in docs just show how to count from 1 to 5 ¿? I'd like to avoid
> counting and using indexed property to access an iterator. The last example
> in docs doesnt seem to work if I replace "this" with the property/objet I
> want to iterate.
>
> I am sure struts2 team has thought of a way to do some partial iterator (I
> can also do the full iterator and do a s:if to show only 5 values using
> status.index, but doesn't seem a nice solution.

Any reason you can't use <c:forEach...>? <s:iterator doesn't have the
same functionality.

Dave


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

RE: s:iterator ¿begin -> end?

by mgainty :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Dave and Crew

Where is the upside down question-mark key???

Martin
______________________________________________
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission.




> Date: Wed, 4 Feb 2009 21:28:03 -0500
> From: newton.dave@...
> To: user@...
> Subject: Re: s:iterator ¿begin -> end?
>
> Ignacio de Córdoba wrote:
> > Hi there,
> > I've checked struts2 docs and this forum and have found no inside syntax for
> > s:iterator tag to do:
> > <c:forEach var='' value='${}' being='1' end='4'/>
> >
> > Examples in docs just show how to count from 1 to 5 ¿? I'd like to avoid
> > counting and using indexed property to access an iterator. The last example
> > in docs doesnt seem to work if I replace "this" with the property/objet I
> > want to iterate.
> >
> > I am sure struts2 team has thought of a way to do some partial iterator (I
> > can also do the full iterator and do a s:if to show only 5 values using
> > status.index, but doesn't seem a nice solution.
>
> Any reason you can't use <c:forEach...>? <s:iterator doesn't have the
> same functionality.
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@...
> For additional commands, e-mail: user-help@...
>

_________________________________________________________________
Windows Live™: E-mail. Chat. Share. Get more ways to connect.
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t2_allup_explore_022009

Re: s:iterator ¿begin -> end?

by Wes Wannemacher :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wednesday 04 February 2009 23:05:06 Martin Gainty wrote:
> Dave and Crew
>
> Where is the upside down question-mark key???
>

It's ALT-F4

:)

-Wes

--

Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher


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


Re: s:iterator ¿begin -> end?

by Ignacio de Córdoba :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

We have it standard in spanish keyboards close to the downside up one :-)

Wes Wannemacher wrote:
On Wednesday 04 February 2009 23:05:06 Martin Gainty wrote:
> Dave and Crew
>
> Where is the upside down question-mark key???
>

It's ALT-F4

:)

-Wes

--

Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher


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

Re: s:iterator ¿begin -> end?

by Musachy Barroso :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I agree with you, I don't use JSTL at all except forEach because of
the few limitations of the iterator tag. I will take a look at it.

regards
musachy

On Wed, Feb 4, 2009 at 9:45 PM, Ignacio de Córdoba <icordoba@...> wrote:

>
> Hi,
> thanks for your reply.
> Well... I have to iterate through a collection accesible in a struts2
> Action. I can make that object visible to the page/request scope and then
> access it from JSTL <c:forEach>; in fact I am doing that for dynamic images
> as strugs2 has no IMG tag to use OGNL directly. Very painful when someone is
> used to access the object from the tag itself. Moreover... I am really
> trying to forget about EL and JSTL. I really don't find my self confortable
> using 3 different expression languages / tag libs in my pages. I didn't have
> to (in struts1) but maybe I have to accept that idea now.
> Moreover, EL is obsolete when compared to OGNL (oh god... when I discovered
> I could do #{people.size()} I just didn't believe it!!! Direct access to
> methods. JSTL hasn't been improved for 4 (5?) years! Method access,
> valuestack... and I am new to OGNL. Don't know 50% of its power!
>
> More situations: I made my HTML designers learn JSTL. Now I have to make
> them learn OGNL and I am sure they'll have problems with both things mixed.
> Of course, I'd like new people in the company thinking about the
> presentation layer just to handle one thing.
>
> Why doesn't OGNL team focus on making it possible to forget about JSTL+EL
> and just use OGNL for every thing? It nearly does!!!! and just because a
> couple of minor glitches we can't. (Another example... s:a tag doesn't have
> "target" attribute. I have then to use HTML   tag directly, what forces me
> to transfer the href data in the Action to an object in the page scope and
> use EL where. Painful for something that should be straightforward.
>
> Well... sorry for the long text. Please don't take me wrong. Just love
> struts2 and would love to forget about old technnologies. I wish I had time
> and knowledge to help on all this. Now I just can't.
>
>
> newton.dave wrote:
>>
>> Ignacio de Córdoba wrote:
>>> Hi there,
>>> I've checked struts2 docs and this forum and have found no inside syntax
>>> for
>>> s:iterator tag to do:
>>> <c:forEach var='' value='${}' being='1' end='4'/>
>>>
>>> Examples in docs just show how to count from 1 to 5 ¿? I'd like to avoid
>>> counting and using indexed property to access an iterator. The last
>>> example
>>> in docs doesnt seem to work if I replace "this" with the property/objet I
>>> want to iterate.
>>>
>>> I am sure struts2 team has thought of a way to do some partial iterator
>>> (I
>>> can also do the full iterator and do a s:if to show only 5 values using
>>> status.index, but doesn't seem a nice solution.
>>
>> Any reason you can't use <c:forEach...>? <s:iterator doesn't have the
>> same functionality.
>>
>> Dave
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@...
>> For additional commands, e-mail: user-help@...
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/s%3Aiterator-%C2%BFbegin--%3E-end--tp21832209p21844359.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@...
> For additional commands, e-mail: user-help@...
>
>



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

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


Re: s:iterator ¿begin -> end?

by newton.dave :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Martin Gainty wrote:
> Where is the upside down question-mark key???

˙ɔɐɯ ǝɥʇ uo ¿-ʇɟıɥs-ʇdo ǝɥʇ s,ʇı

Dave


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


Re: s:iterator ¿begin -> end?

by Musachy Barroso :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok, here is the Jira ticket:

https://issues.apache.org/struts/browse/WW-2984

I committed the changes to the iterator tag, here is how it works: New
attributes "begin", "end" and "step" were added. They can be used by
themselves, or with List and Arrays, like:

<s:iterator begin="1" end="5" step="2" >
...
<s:iterator begin="5" end="1" step="-1" >
...
<s:iterator begin="1" end="5" step="2" value="myList">
...
<s:iterator begin="5" end="1" step="-1" value="myArray">

Things to consider (let me make  sure that google gets this :)):

* When "values" is specified with "begin", then "value" must point to
a List or an Array
* The "end" attribute is inclusive, just like in JSTL, if a List/Array
is used, "end" is optional, and it will default to the size of the
List/Array, or to 0 if "step" is negative.
* If "step" is negative, then "begin" must be greater than "end"

I think that covers most of the use-cases. Testing is welcome (I added
a bunch of tests to IteratorTagTest).

musachy


On Thu, Feb 5, 2009 at 9:21 AM, Musachy Barroso <musachy@...> wrote:

> I agree with you, I don't use JSTL at all except forEach because of
> the few limitations of the iterator tag. I will take a look at it.
>
> regards
> musachy
>
> On Wed, Feb 4, 2009 at 9:45 PM, Ignacio de Córdoba <icordoba@...> wrote:
>>
>> Hi,
>> thanks for your reply.
>> Well... I have to iterate through a collection accesible in a struts2
>> Action. I can make that object visible to the page/request scope and then
>> access it from JSTL <c:forEach>; in fact I am doing that for dynamic images
>> as strugs2 has no IMG tag to use OGNL directly. Very painful when someone is
>> used to access the object from the tag itself. Moreover... I am really
>> trying to forget about EL and JSTL. I really don't find my self confortable
>> using 3 different expression languages / tag libs in my pages. I didn't have
>> to (in struts1) but maybe I have to accept that idea now.
>> Moreover, EL is obsolete when compared to OGNL (oh god... when I discovered
>> I could do #{people.size()} I just didn't believe it!!! Direct access to
>> methods. JSTL hasn't been improved for 4 (5?) years! Method access,
>> valuestack... and I am new to OGNL. Don't know 50% of its power!
>>
>> More situations: I made my HTML designers learn JSTL. Now I have to make
>> them learn OGNL and I am sure they'll have problems with both things mixed.
>> Of course, I'd like new people in the company thinking about the
>> presentation layer just to handle one thing.
>>
>> Why doesn't OGNL team focus on making it possible to forget about JSTL+EL
>> and just use OGNL for every thing? It nearly does!!!! and just because a
>> couple of minor glitches we can't. (Another example... s:a tag doesn't have
>> "target" attribute. I have then to use HTML   tag directly, what forces me
>> to transfer the href data in the Action to an object in the page scope and
>> use EL where. Painful for something that should be straightforward.
>>
>> Well... sorry for the long text. Please don't take me wrong. Just love
>> struts2 and would love to forget about old technnologies. I wish I had time
>> and knowledge to help on all this. Now I just can't.
>>
>>
>> newton.dave wrote:
>>>
>>> Ignacio de Córdoba wrote:
>>>> Hi there,
>>>> I've checked struts2 docs and this forum and have found no inside syntax
>>>> for
>>>> s:iterator tag to do:
>>>> <c:forEach var='' value='${}' being='1' end='4'/>
>>>>
>>>> Examples in docs just show how to count from 1 to 5 ¿? I'd like to avoid
>>>> counting and using indexed property to access an iterator. The last
>>>> example
>>>> in docs doesnt seem to work if I replace "this" with the property/objet I
>>>> want to iterate.
>>>>
>>>> I am sure struts2 team has thought of a way to do some partial iterator
>>>> (I
>>>> can also do the full iterator and do a s:if to show only 5 values using
>>>> status.index, but doesn't seem a nice solution.
>>>
>>> Any reason you can't use <c:forEach...>? <s:iterator doesn't have the
>>> same functionality.
>>>
>>> Dave
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@...
>>> For additional commands, e-mail: user-help@...
>>>
>>>
>>>
>>
>> --
>> View this message in context: http://www.nabble.com/s%3Aiterator-%C2%BFbegin--%3E-end--tp21832209p21844359.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@...
>> For additional commands, e-mail: user-help@...
>>
>>
>
>
>
> --
> "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@...
For additional commands, e-mail: user-help@...


Re: s:iterator ¿begin -> end?

by Greg Lindholm :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Great! Thanks a lot for this, it was needed.

Musachy Barroso wrote:
Ok, here is the Jira ticket:

https://issues.apache.org/struts/browse/WW-2984

I committed the changes to the iterator tag, here is how it works: New
attributes "begin", "end" and "step" were added. They can be used by
themselves, or with List and Arrays, like:

<s:iterator begin="1" end="5" step="2" >
...
<s:iterator begin="5" end="1" step="-1" >
...
<s:iterator begin="1" end="5" step="2" value="myList">
...
<s:iterator begin="5" end="1" step="-1" value="myArray">

Things to consider (let me make  sure that google gets this :)):

* When "values" is specified with "begin", then "value" must point to
a List or an Array
* The "end" attribute is inclusive, just like in JSTL, if a List/Array
is used, "end" is optional, and it will default to the size of the
List/Array, or to 0 if "step" is negative.
* If "step" is negative, then "begin" must be greater than "end"

I think that covers most of the use-cases. Testing is welcome (I added
a bunch of tests to IteratorTagTest).

musachy


Re: s:iterator ¿begin -> end?

by Volker Karlmeier :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

With 2.1.8, you can use

<s:iterator begin="startValue" end="endValue" step="1">
...
</s:iterator>

But it still has a bug: see http://issues.apache.org/struts/browse/WW-3314

Regards

   Volker

Am 04.02.2009 16:04, schrieb Ignacio de Córdoba:

> Hi there,
> I've checked struts2 docs and this forum and have found no inside syntax for
> s:iterator tag to do:
> <c:forEach var='' value='${}' being='1' end='4'/>
>
> Examples in docs just show how to count from 1 to 5 ¿? I'd like to avoid
> counting and using indexed property to access an iterator. The last example
> in docs doesnt seem to work if I replace "this" with the property/objet I
> want to iterate.
>
> I am sure struts2 team has thought of a way to do some partial iterator (I
> can also do the full iterator and do a s:if to show only 5 values using
> status.index, but doesn't seem a nice solution.
>
> Thanks,
> Ignacio
>    


--
-------------------------------
words a just some place to hide
a wall that we can run behind..
-------------------------------
Volker Karlmeier
Friedrich-Freye-Str. 61
45481 Mlheim/Ruhr

Tel. :  (+49) 208-7785675
Mobil:  (+49) 176-21056587
Mail :  Volker@...



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


Re: s:iterator ¿begin -> end?

by Musachy Barroso :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

<s:iterator begin="2" end="9" step="1" var="val">
      <s:property value="%{#val}"/> <br/>
 </s:iterator>

Prints:

2
3
4
5
6
7
8
9

it seems to work fine.

On Wed, Nov 4, 2009 at 1:35 PM, Volker Karlmeier <volker@...> wrote:

> With 2.1.8, you can use
>
> <s:iterator begin="startValue" end="endValue" step="1">
> ...
> </s:iterator>
>
> But it still has a bug: see http://issues.apache.org/struts/browse/WW-3314
>
> Regards
>
>  Volker
>
> Am 04.02.2009 16:04, schrieb Ignacio de Córdoba:
>>
>> Hi there,
>> I've checked struts2 docs and this forum and have found no inside syntax
>> for
>> s:iterator tag to do:
>> <c:forEach var='' value='${}' being='1' end='4'/>
>>
>> Examples in docs just show how to count from 1 to 5 ¿? I'd like to avoid
>> counting and using indexed property to access an iterator. The last
>> example
>> in docs doesnt seem to work if I replace "this" with the property/objet I
>> want to iterate.
>>
>> I am sure struts2 team has thought of a way to do some partial iterator (I
>> can also do the full iterator and do a s:if to show only 5 values using
>> status.index, but doesn't seem a nice solution.
>>
>> Thanks,
>> Ignacio
>>
>
>
> --
> -------------------------------
> words a just some place to hide
> a wall that we can run behind..
> -------------------------------
> Volker Karlmeier
> Friedrich-Freye-Str. 61
> 45481 Mlheim/Ruhr
>
> Tel. :  (+49) 208-7785675
> Mobil:  (+49) 176-21056587
> Mail :  Volker@...
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@...
> For additional commands, e-mail: user-help@...
>
>

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