PIN1: <s:property value="device[0].PIN"/>
         Total Count: <s:property value="deviceCount"/>
         <TABLE>
                 <s:iterator value="device">
                         <TR>
                               <TD>
                                    <s:property value="PIN"/>
                               </TD>
                              <TD>
                                    <s:property value="version"/></TD>
                              </TR>
                </s:iterator>
        </TABLE>

some references:
iterator: http://struts.apache.org/2.x/docs/iterator.html
OGNL: http://struts.apache.org/2.x/docs/ognl.html

musachy

On 6/5/07, yitzle <[EMAIL PROTECTED]> wrote:

Before I begin, I apologize if I offend anyone by asking a question
that could easily be found in the Struts 2 documentation by searching
for the correct keywords, and, no, I did not read the entire Struts
documentation nor any other Struts textbook (though I did read and
appreciate a good chunk of the Starting Struts 2 book).

See code below (numbered with cat -n).
Lines 0,1 work well. Lines 4,7,8 don't work. For line 4, I also tried
%{}, <%= %>. For line 7/8 I tried device[i].
Can someone tell me the correct way to escape/access the JSP variables
inside a Struts tag, and a Struts property (from a getter) in JSP?

Thanks!

Code:
0          PIN1: <s:property value="device[0].PIN"/>
1          Total Count: <s:property value="deviceCount"/>
2          <TABLE>
3                  <%
4                  for ( int i = 0; i < deviceCount; i++ ) {
5                          %>
6                          <TR>
7                                          <TD><s:property
value="device[%{i}].PIN"/></TD>
8                                          <TD><s:property
value="device[<%=i%>].version"/></TD>
9                                  </TR>
10                          <%
11                  }
12                  %>
13          </TABLE>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




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

Reply via email to