首页 > 解决方案 > 动态添加瓦片到jsp页面

问题描述

我是 struts-1 和瓷砖的新手。我遇到的问题是动态地将图块添加到表中。谁能指出我正确的方向

myTestTable.jsp //带有表格和脚本的jsp页面添加新行

<table id="testing" style="padding-top: 10px">
    <thead>
        <tr>
            <th>Student Name</th>
        </tr>
    </thead>
    <tbody>
        <tr>
          <td><a href="javascript:void(0);" class="addCF">Add</a></td>
          <td>
            <tiles:insert definition=".textInput">
              <tiles:put name="property" value="parameter[01]"/>
              <tiles:put name="width" value="75"/>                               
            </tiles:insert>
           </td>
         <tr>
       </tbody>
</table>


<script type="text/javascript">
$(document).ready(function(){
$(".addCF").click(function(){
    $("#testing").append('<tr><td>
        <tiles:insert definition=".textInput">
          <tiles:put name="property" value="parameter[02]"/>
          <tiles:put name="width" value="75"/> 
        </tiles:insert></td> </tr>');
});
});


</script>

这是添加另一行瓷砖的正确方法吗?还是有更好的方法来解决这个问题?它必须是每次用户单击添加按钮时,所以可能是 1 或 20。

标签: javascripthtmljspstrutstiles

解决方案


推荐阅读