You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by TonyD <an...@eunics.it> on 2007/07/06 14:45:07 UTC
How to set checkbox label value in a iterator
I have a iterator where each value is the label of a checkbox.
How could I set each value into the checkbox label?
This is code:
<s:iterator id="reports" value="reports" status="reportStatus">
<tr>
<td>
<s:checkbox name="reports" label="%{reports}" value="false"/>
</td>
</tr>
</s:iterator>
label="%{reports}" sets all values of the iterator.
Where could I find all status properties (first, last, odd, even, count,
etc.)
Thanks in advance.
Tony
--
View this message in context: http://www.nabble.com/How-to-set-checkbox-label-value-in-a-iterator-tf4035305.html#a11463698
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How to set checkbox label value in a iterator
Posted by TonyD <an...@eunics.it>.
Thanks that's what I needed.
I'am sure it's a powerful language but the success of a language is also how
easy it is to find what you need, the documentation is poor of examples and
it's hard to someone that's new with this type of language.
Hope in your collaboration in future. Thanks.
DNewfield wrote:
>
> TonyD wrote:
>> Well I found out what index is (index=count +1)
>
> Bzzt. Index is a zero-based iteration count, count is a one-based
> iteration count, so index+1=count.
>
>> but a need something that tells me how much iterations are there
>> before reaching the end of interation.
>
> That has nothing to do with the iterator. It's a simple number you want
> added to the output of the jsp. We tend to do that with the s:property
> tag.
>
> So if your iterator is
> <s:iterator value="%{foo}" status="iterStatus">...</s:iterator>
> what you're looking for is just
> <s:property value="%{foo.size}"/>
>
> Read up on ognl. It's a very powerful language that you're using
> whether you realize it or not.
>
> -Dale
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/How-to-set-checkbox-label-value-in-a-iterator-tf4035305.html#a11516246
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How to set checkbox label value in a iterator
Posted by Dale Newfield <Da...@Newfield.org>.
TonyD wrote:
> Well I found out what index is (index=count +1)
Bzzt. Index is a zero-based iteration count, count is a one-based
iteration count, so index+1=count.
> but a need something that tells me how much iterations are there
> before reaching the end of interation.
That has nothing to do with the iterator. It's a simple number you want
added to the output of the jsp. We tend to do that with the s:property tag.
So if your iterator is
<s:iterator value="%{foo}" status="iterStatus">...</s:iterator>
what you're looking for is just
<s:property value="%{foo.size}"/>
Read up on ognl. It's a very powerful language that you're using
whether you realize it or not.
-Dale
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How to set checkbox label value in a iterator
Posted by TonyD <an...@eunics.it>.
Well I found out what index is (index=count +1), but a need something that
tells me how much iterations are there before reaching the end of
interation.
Example:
Emplooyes: 2350 (I need to know this value before iterations)
Emplooyes data 1 ........
Emplooyes data 2 ........
.....
Emplooyes data 2350 ........
Thanks.
DNewfield wrote:
>
> TonyD wrote:
>> label="%{reports[#reportStatus.count -1]}"
>>
>> Where could I find all status properties (first, last, odd, even, count,
>> etc.)
>
> http://struts.apache.org/2.0.8/struts2-core/apidocs/org/apache/struts2/views/jsp/IteratorStatus.html
>
> Looks like what you want is "index".
>
> -Dale
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/How-to-set-checkbox-label-value-in-a-iterator-tf4035305.html#a11500040
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How to set checkbox label value in a iterator
Posted by Dale Newfield <Da...@Newfield.org>.
TonyD wrote:
> label="%{reports[#reportStatus.count -1]}"
>
> Where could I find all status properties (first, last, odd, even, count,
> etc.)
http://struts.apache.org/2.0.8/struts2-core/apidocs/org/apache/struts2/views/jsp/IteratorStatus.html
Looks like what you want is "index".
-Dale
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How to set checkbox label value in a iterator
Posted by TonyD <an...@eunics.it>.
:clap:
FOUND:
label="%{reports[#reportStatus.count -1]}"
Where could I find all status properties (first, last, odd, even, count,
etc.)
TonyD wrote:
>
> I have a iterator where each value is the label of a checkbox.
> How could I set each value into the checkbox label?
>
> This is code:
>
> <s:iterator id="reports" value="reports" status="reportStatus">
> <tr>
> <td>
> <s:checkbox name="reports" label="%{reports}" value="false"/>
> </td>
> </tr>
> </s:iterator>
>
> label="%{reports}" sets all values of the iterator.
>
> Where could I find all status properties (first, last, odd, even, count,
> etc.)
>
> Thanks in advance.
> Tony
>
--
View this message in context: http://www.nabble.com/How-to-set-checkbox-label-value-in-a-iterator-tf4035305.html#a11463841
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org