<?xml version="1.0" encoding="UTF-8"?> <m:mayaa xmlns:m="http://mayaa.seasar.org" xmlns:s="http://sastruts.seasar.org" xmlns:f="http://sastruts.seasar.org/functions" xmlns:bean="http://jakarta.apache.org/struts/tags-bean" xmlns:html="http://jakarta.apache.org/struts/tags-html" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:fmt="http://java.sun.com/jstl/fmt" xmlns:fn="http://java.sun.com/jsp/jstl/functions"> <m:beforeRender><![CDATA[ var idxs = [2,1,4,2,3,6,1]; var buf = []; for (var i in idxs){ for (var j = 0; j < idxs[i]; j++){ if (j == 0 && idxs[i] == 1){ buf.push('<tr>'); buf.push('<td>NoNoNo</td>'); buf.push('<td>NaNaNa</td>'); buf.push('<td>girl</td>'); buf.push('<td>Jiangxi</td>'); buf.push('<td>列</td>'); buf.push('</tr>'); j = idxs[i] + 2; } else if (j == 0 && idxs[i] > 1){ buf.push('<tr>'); buf.push('<td>列</td>'); buf.push('<td rowspan=' + idxs[i] + '>跨行</td>'); buf.push('<td>列</td>'); buf.push('<td rowspan=' + idxs[i] + '>跨行</td>'); buf.push('<td>列</td>'); buf.push('</tr>'); } else{ buf.push('<td>列fuck</td>'); buf.push('<td>列fuck</td>'); buf.push('<td>列</td>'); buf.push('</tr>'); } } } var content = buf.join(); ]]></m:beforeRender> <m:for m:id="loop" init="${var idx = 0}" test="${idx < 10}" after="${idx++}" max="-1" > ${content} </m:for> </m:mayaa>
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Create by dolphin</title> </head> <body> <table border="1"> <tr id="header"> <th>name</th> <th>sex</th> <th>age</th> <th>school</th> <th>myname</th> </tr> <span id="loop"> <tr id="content"> <td>Dummy content1</td> <td>Dummy content2</td> <td>Dummy content3</td> </tr> </span> </table> </body> </html>