Instance code for dynamically merging cells in a JSP _jsp programming

Source: Internet
Author: User

Nonsense is not much to say, the specific code looks like this:

<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" va Lue= "0" ></c:set><%--temporary variable--%> <c:set var= "rowspancount" value= "0" ></c:set><%--record number of merged columns --%> <c:set var= "tempfrist" value= "0" ></c:set><%--record merge start location--%> <c:set var= "TempEnd"- 1 "></c:set><%--record merge end position--%> <c:foreach items=" ${list "var=" Accountconfig "status" > <tr> <%--Use a result set list<bean> to generate, too much data will aggravate customer--%> <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 refers to the properties 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& 
Gt </c:if> <c:if test= "${status.index==tempfrist}" > <td rowspan= "${rowspancount}" > <%-- TableName refers to the properties to be merged--%> ${accountconfig.tablename} </td> </c:if> </tr> </c:forEach> </ta  Ble> </span>

The above is a small set of JSP to introduce dynamic merged cells in the example code, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.