提取供应商列表并将其显示在JSP Functions列中(Pulling a list of vendors and displaying them into columns JSP Function

编程入门 行业动态 更新时间:2024-10-22 23:33:47
提取供应商列表并将其显示在JSP Functions列中(Pulling a list of vendors and displaying them into columns JSP Functions)

我得到一个名单列表,我想将它们显示在(3)列中。 什么是使用jsp函数执行此操作的最佳方法?

列表:

apples oranges cherries limes pineapples grapefruits coconuts watermelons grapes bananas pears peaches

预期产出 -

Column 1 - apples, oranges, cherries, and limes / Column 2 - pineapples, grapefruits, coconuts, and watermelons / Column 3 - grapes, bananas, pears, peaches

可以说我想指定每列中有多少行,使用jsp函数执行此操作的最佳方法是什么?

另一种情况是,如果有一个包含13个项目的列表并按列数(3)划分,则会得到4.333333333 ..

我可以使用什么函数示例在第一列中获得6,在第二列中获得6,在第三列中获得1?

任何想法或评论,我真的很感激帮助......

I am getting a list of names and I would like to display them into (3) columns. Whats would be the best way to do this using a jsp function?

List:

apples oranges cherries limes pineapples grapefruits coconuts watermelons grapes bananas pears peaches

Expected Output -

Column 1 - apples, oranges, cherries, and limes / Column 2 - pineapples, grapefruits, coconuts, and watermelons / Column 3 - grapes, bananas, pears, peaches

Lets say that I wanted to specify how many rows are in each column, what would be the best way to do this using a jsp function?

Another scenario would be, if there is a list of 13 items and you divide that by the number of columns (3), you would get 4.333333333..

What function example could I used to get 6 in the first column, 6 in the second column and 1 in the 3rd column?

Any thoughts or comments I would really be grateful for the help...

最满意答案

循环遍历您的集合,当添加6行添加新列时,您可以使用嵌套表,但首选div。

<c:forEach varStatus="count" var="fruit" items="${fruits}"> ... <c:when test=${count.index % 6 == 0}> //when loop count is multiple of six ... // create your column structure, be it, td, table or div </c:when> </c:forEach>

Loop over your collection, when 6 rows added add a new column, you could use nested tables, but div's are preferred.

<c:forEach varStatus="count" var="fruit" items="${fruits}"> ... <c:when test=${count.index % 6 == 0}> //when loop count is multiple of six ... // create your column structure, be it, td, table or div </c:when> </c:forEach>

更多推荐

本文发布于:2023-08-04 23:09:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1424516.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:供应商   列表   并将其   JSP   Functions

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!