• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to call Servlet from HTML

 
navneet rajput
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am trying to call servlet from HTml but it giving error like:- The requested resource (/SampleFileUploading/servlet/com.servlet.FileUploadServlet) is not available
I have sample client code as below

<FORM ENCTYPE='multipart/form-data' method='POST' action='servlet/com.servlet.FileUploadServlet'>
<INPUT TYPE='file' NAME='test'>
<INPUT TYPE='submit' VALUE='upload'>
</FORM>

In Action I have given my servlet class path.

And my Web.xml is as below

<servlet>
<description></description>
<display-name>FileUploading</display-name>
<servlet-name>FileUploading</servlet-name>
<servlet-class>com.servlet.FileUploadServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>FileUploading</servlet-name>
<url-pattern>/FileUpload</url-pattern>
</servlet-mapping>

Please give me some pointers related to same.
all kind of help will be appreciated.

Thanks,
Navneet



 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since the servlet is mapped to "/FileUpload", that's what should be in the "action" attribute (without the leading slash). Package and class names have no place there.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!