| |

VerySource

 Forgot password?
 Register
Search
View: 929|Reply: 7

Questions about the usage of

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-3-11 12:30:01
| Show all posts |Read mode
I have 10 elements in my list. How to use <logic: iterator> to display these 10 elements in two lines (or 3 lines, etc.)?
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-7-1 23:30:02
| Show all posts
Has anyone done this before?
I have used the most stupid method, split into two LIST, is there a direct way?
Reply

Use magic Report

0

Threads

4

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-7-13 22:30:01
| Show all posts
<logic:iterator>
<tr><td><bean:write /></td></tr>
</logic:iterator>
is this okay?
Reply

Use magic Report

0

Threads

39

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 China

Post time: 2020-7-18 10:30:01
| Show all posts
http://hyysios.javaeye.com/blog/27542

Use Struts logic tags, use indeId to automatically output the serial number and add one when traversing the List
  Examples are as follows:
   
  <table>
  <tr>
  <td>Serial number</td>
  <td>Name</td>
  ...
  </tr>
  <logic:present name="targetbean">
  <logic:iterate name='helperbean' id='helperbean' type='net.echochina.HelperBean' scope='request' indexId="index">
  <tr>
  <td><%= index.intValue() + 1 %></td>
  <td><bean:write name='helperbean' property='name' /></td>
  .....
  </tr>
  </logic:iterate>
  </logic:present>
  </table>

Deal with index.intValue() /2 or /3 yourself, and organize <tr><td>.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-7-29 20:00:01
| Show all posts
Positive answer upstairs
In <logic:iterate> you can <bean:write name="index"/> to get the current record position (starting from 0)
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-31 23:15:01
| Show all posts
Let me talk about the solution. If only one column is displayed when traversing, then a List is passed from the background, but if you want to display two columns, then put a List to put information into two Lists through a for loop. Go to the front desk to traverse in two columns, it's very simple
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-31 23:30:01
| Show all posts
Haha. . . I just want people who have the same problem to see this post to see an answer! ! !
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-2 16:15:02
| Show all posts
<logic:iterate name='aaaaa' id='bbbbbb' indexId= "index ">
    <tr>
    <td> <bean:write name ='aaaaa' property ='name' /> </td>
    .....
    </tr>
</logic>
Note: Generally iterate is used to indicate the details. The corresponding ACTIONFORM is generally List<Object>. The indexId is used to identify the row when performing JS operations on the details. Refer to the 6th floor for specific usage. The difficulty lies in the details. In the case of input, the back-end actionform needs special processing.The specific method can be checked on the Internet.In addition to the definition of List<Object>, it is also necessary to define the Object in List<Object>, the name is the same as name ='aaaaa'.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list