在jsp中使用display标记删除确认

Struts 1 Delete Confirmation using display tag in jsp

本文关键字:删除 确认 display jsp      更新时间:2023-09-26

我试图显示一个删除确认框,一旦用户点击删除按钮内的显示:列。我有对话框显示,但一旦用户确认,他要删除的行动没有被调用。页面只是重新加载,而不删除行。如果没有删除确认,该行将被成功删除。我的确认书出了问题。任何帮助都会很感激,谢谢

我现在拥有的是:

jQuery:

$(".btnShowDeleteConfirmation").click(function (e)
          {
             ShowDialog(true);
             e.preventDefault();
          });
          $("#btnClose, #btnNo").click(function (e)
          {
             HideDialog();
             e.preventDefault();
          });
          $("#btnYes").click(function (e)
          {
            });
Javascript:

   function deleteEntry(rowId)
  {
    document.getElementById('rowId').value=rowId;
    document.forms['myForm'].action='/myAction/deleteAction.action?method=deleteRow';
    document.forms['myForm'].submit;       
  }

display tag table:

<form action="" method="POST" id="mainForm" name="MyFormBean">
<display:table requestURIcontext="true"  requestURI="/unavailability/loadUnavailability.action?method=loadForm" uid="myList" name="requestScope.unavailList" class="simple" pagesize="10" defaultsort="2" sort="list"  cellspacing="0" excludedParams="*">    
<display:column  property="startDate" title="Start Date" width="18%"   decorator="com.mhngs.util.DisplayTagDateWrapper" sortable="true" headerClass="sortable"/>
<display:column  property="endDate" title="End Date" width="18%"  decorator="com.mhngs.util.DisplayTagDateWrapper" sortable="true" headerClass="sortable" />
<display:column  property="reason" title="Comments" width="30%" sortable="true" headerClass="sortable" />   
<display:column media="html" width="10%" class="btnShowDeleteConfirmation">
<a href="#">Delete</a>
</display:column>

</display:table> 
<input type="hidden" name="rowId" id="rowId" />
</form>

HTML:当用户点击删除按钮

时将显示
<div id="overlay" class="delete_overlay"></div>
        <div id="dialog_delete" class="delete_overlay">
        <form method="post" action="">  
            <table style="width: 100%; border: 0px;" cellpadding="3" cellspacing="0">
                 <tr>
                    <td class="web_dialog_title">Delete Row Confirmation</td>
                    <td class="web_dialog_title align_right"><a href="#" id="btnClose">Close</a></td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td colspan="2" style="padding-left: 15px;">
                        <label>You seleted a row to be deleted</label>
                    </td>
                </tr>
          <tr>
             <td>&nbsp;</td>
             <td>&nbsp;</td>
          </tr>
          <tr>
             <td colspan="2" style="text-align: center;">
                <input id="btnYes" type="submit" value="Yes" onClick="javascript:deleteEntry('<c:out  value="${myList.rowId}"/>')"/>
                <input id="btnNo" type="button" value="No" />
             </td>
             </tr>
             </table>
        </form>
    </div>

您没有在html中指定表单名称。你在哪里提到"myForm"的名称在表单标签?

<form name="myForm" .. >