日期:2014-05-17  浏览次数:20613 次

submit之后无法执行servlet,求教,急!!!!
在表单summit之后无法执行servlet,求教,急!!!!
form表单:
HTML code

<form id="DOBJECT_IMPORT" name="DOBJECT_IMPORT"    action="/servlet/ImportFileServlet" enctype="multipart/form-data" method="post" target="hidden_dboject_frame">                                                                                    



js:
JScript code

 var id = document.getElementById("DOBJECT_IMPORT");
  id.submit();



调试id.submit确实执行了

web.xml:

<servlet>
<servlet-name>ImportFileServlet</servlet-name>
<servlet-class>com.framework.servlet.UploadServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ImportFileServlet</servlet-name>
<url-pattern>/servlet/ImportFileServlet</url-pattern>
</servlet-mapping>

java:
package com.framework.servlet;
public class UploadServlet extends HttpServlet {

}

------解决方案--------------------
表单提交需加上web应用名 action="/应用名/servlet/ImportFileServlet"
------解决方案--------------------
document.forms[0].submit()试试呢。。

或者document.all.DOBJECT_IMPORT.submit();
------解决方案--------------------
有报404没,action="/servlet/ImportFileServlet" 把你的action路径前面加上你的项目名看看