我正在尝试删除图像文件并替换新图像...但我没有正确并面临很多错误..请纠正它并给我解决方案..请纠正我的错误
//JSP代码
<tr id="docFileUpload_<%=AppConstants.FALSE%>">
<c:set var="answerSize" value="${fn:length(editForm.answer[0])}"/>
<td class="data">A.
<c:choose>
<c:when test="${editForm.answer[0]!=null}">
<form:input path="answer[0]" size="50" maxlength="250" id="remove_image"/><br>      <strong><fmt:message key="label.or"/></strong><br>
<input type="file" name="answerImage[0]"/>
</c:when>
<c:otherwise>
<img alt="" src="${answerPath0}">
</c:otherwise>
</c:choose>
<c:out value="${editForm.answerImage[0]}"/> [<a href="javascript:processRemoveDocFile();"><fmt:message key="link.removeFile"/></a>]
</td>
<td class="data"><form:checkbox path="flag[0]" value="true"/>
</tr>
<tr id="docFileUpload_<%=AppConstants.TRUE%>">
<td class="data" >
<input type="file" name="answerImage[0]"/>
</td>
<td class="data"><form:checkbox path="flag[0]" value="true"/>
</tr>
//Java脚本代码
<script type="text/javascript">
var maxLenArray = new Array('comments||500');
initMaxLengthAttributes(maxLenArray);
function init()
{
//var maxLenArray = new Array('document_descId||500', 'document_commentsId||500');
//initMaxLengthAttributes(maxLenArray);
processDocFileUploadOnLoad();
processTempFileUploadOnLoad();
}
</script>
<script>
function processDocFileUploadOnLoad()
{
// get reference to form
var theForm = YAHOO.util.Dom.get('editForm');
// get reference to radio buttons
var docFileUpdateRef = theForm.document_file_update;
processDocFileUpload(docFileUpdateRef);
}
function processDocFileUpload(fileUpdateRef)
{
var fileUpdateValue = fileUpdateRef.value;
var selectedSectionId = 'docFileUpload_' + fileUpdateValue;
var trueSectionId = 'docFileUpload_' + '<%=AppConstants.TRUE%>';
var falseSectionId = 'docFileUpload_' + '<%=AppConstants.FALSE%>';
// show old input, hide current input
if(fileUpdateValue == '<%=AppConstants.TRUE%>')
{
switchSections(selectedSectionId, new Array(falseSectionId));
}
// show current input, hide old input
else if(fileUpdateValue == '<%=AppConstants.FALSE%>')
{
switchSections(selectedSectionId, new Array(trueSectionId));
}
}
function processRemoveDocFile()
{
// get reference to form
var theForm = YAHOO.util.Dom.get('editForm');
var docFileUpdateRef = theForm.document_file_update;
docFileUpdateRef.value = true;
processDocFileUpload(docFileUpdateRef);
}
</script>
<script>
YAHOO.util.Event.onDOMReady(init);
</script>