Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

How to call Servlet from HTML

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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



 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic