我正在使用显示标签将我的列表显示在表格上。我试图有一个按钮来删除基于行 ID 的行。id 正在传递给我的 javascript 函数,但没有调用该操作。我知道该值正在传递,因为当我使用 alert 测试在函数中输出 id 时,它确实传递了。
我跑了萤火虫,它说我的表格是未定义的
我现在拥有的是
显示标签表:
<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%">
<a href="#" onClick="javascript:deleteEntry('<c:out value="${myList.rowId}"/>')">Delete</a>
</display:column>
</display:table>
<input type="hidden" name="rowId" id="rowId" />
</form>
Javascript:
function deleteEntry(rowId){
document.getElementById('rowId').value=rowId;
document.forms[0].action='/app/protected/mflc/unavailability/delCounselorEntry.action?method=deleteCounselorUnavailability';
document.forms['myForm'].submit; //Correction
}
Struts Form Bean:
<form-bean name="MyFormBean" type="org.apache.struts.action.DynaActionForm">
<form-property name="myList" type="java.util.List"/>
</form-bean>
Struts 删除映射:
<action path="/unavailability/delCounselorEntry"
type="com.action.MyAction"
scope="request"
parameter="method"
name="MyFormBean">
<forward name="Success"
path="/unavailability/myDeleteComfirmationPage.actioncontent" />
</action>
任何帮助将不胜感激,谢谢