The sample code for dynamically merging cells in JSP. Does jsp dynamically merge cells?

Source: Internet
Author: User

The sample code for dynamically merging cells in JSP. Does jsp dynamically merge cells?

The Code is as follows:

<Span style = "font-size: 14px;"> <% @ taglib prefix = "c" uri =" http://java.sun.com/jsp/jstl/core "%> <Table width =" 100% "border =" 0 "cellspacing =" 0 "cellpadding =" 0 "> <tr> <th> report name </th> </ tr> <c: set var = "tempCount" value = "0"> </c: set> <% -- temporary variable -- %> <c: set var = "rowspanCount" value = "0"> </c: set> <% -- Record merged columns -- %> <c: set var = "tempFrist" value = "0"> </c: set> <% -- start position of record merging -- %> <c: set var = "tempEnd" value = "-1"> </c: set> <% -- end position of record merging -- %> <c: forEach items = "$ {list}" var = "accountConfig" varStatus = "status"> <tr> <% -- generate a result set List <Bean>, too much data will increase the customer's interruption burden -- %> <c: if test = "$ {status. index> = tempEnd} "> <c: set var =" rowspanCount "value =" 0 "> </c: set> <% -- clear historical data -- %> <c: forEach var = "item2" items = "$ {list}" varStatus = "status2"> <% -- tablename indicates the attribute to be merged -- %> <c: if test = "$ {accountConfig. tablename = item2.tablename} "> <c: set var =" tempFrist "value =" $ {status. index} "> </c: set> <c: set var =" rowspanCount "value =" $ {rowspanCount + 1} "> </c: set> <c: set var = "tempEnd" value = "$ {tempFrist + rowspanCount}"> </c: set> </c: if> </c: forEach> </c: if> <c: if test = "$ {status. index = tempFrist} "> <td rowspan =" $ {rowspanCount} "> <% -- tablename indicates the attribute to be merged -- % >$ {accountConfig. tablename} </td> </c: if> </tr> </c: forEach> </table> </span>

The above is the sample code for dynamically merging cells in JSP introduced by xiaobian. I hope it will be helpful to you. If you have any questions, please leave a message and I will reply to you in a timely manner. Thank you very much for your support for the help House website!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.