| |

VerySource

 Forgot password?
 Register
Search
View: 1543|Reply: 12

struts tags solve looping problems

[Copy link]

1

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-1-26 14:40:02
| Show all posts |Read mode
Is there a way to replace struts tags on the jsp page
for (int i = a; i <b; i ++)
{
.....
}
a, b are variables of type int
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 France

Post time: 2020-2-17 21:00:01
| Show all posts
With <logic: iterate> tag
Reply

Use magic Report

1

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-2-19 10:30:01
| Show all posts
<logic: iterate> isn't iterating over the array
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 Japan

Post time: 2020-2-22 10:15:01
| Show all posts
<logic: iterate> can traverse arrays, maps, lists
Reply

Use magic Report

0

Threads

63

Posts

42.00

Credits

Newbie

Rank: 1

Credits
42.00

 United States

Post time: 2020-3-1 17:00:02
| Show all posts
If it's just for outputting "static" HTML with N repeats, use <% for%>.
Otherwise, from the perspective of a normal programmer's thinking, you most likely (if not 100%) are traversing a "collection". This collection may be an array, it may be java.util.Collection, or it may be java.util.Map or anything that implements java.util.Iterable. And all the types listed above can be handled by logic: iterate, except that it needs to be located in PageContext, that is, page, request, session, etc.
Reply

Use magic Report

0

Threads

63

Posts

42.00

Credits

Newbie

Rank: 1

Credits
42.00

 China

Post time: 2020-3-1 20:00:02
| Show all posts
Also, in <logic: iterate>, the start and end points use offset and length attributes
Reply

Use magic Report

0

Threads

3

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 Germany

Post time: 2020-7-6 23:30:01
| Show all posts
You can also use iteration in JSTL to add EL expressions!
Reply

Use magic Report

1

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-8-4 14:30:01
| Show all posts
Then <logic:iterate> can't traverse ordinary loops
Can the el expression be realized?
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 Invalid IP Address

Post time: 2020-8-4 16:30:01
| Show all posts
<logic:iterate>
Reply

Use magic Report

1

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-8-9 12:30:01
| Show all posts
Can you give me an example?
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