Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Resource not found

 
nandini lagunia
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a html page from where I am trying to call a servlet.

the html page looks like as follows:-




The web.xml file looks like:-



I am usging tomcat 6.
Now when I submit the html form, it ideally should invoke the servlet but I am getting "The requested resource (/servlet/FileUploaderServlet) is not available." instead.
The snapshot of the directory structure of my web application can be found in the attachment.

Can anyone give me any pointers where I am committing the mistake?


struct.png
[Thumbnail for struct.png]
directory structure
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64975
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are not including the context path in the action URL.

P.S. Mapping servlets with a prefix of "/servlet/" looks really amateurish. Why the needless prefix? Also, including the term "Servlet" inthe mapping at all is poor -- it reveals the underlying implementation needlessly. I'd rethink your mapping names.
 
nandini lagunia
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear for the help.

I'll keep your suggestions in my mind.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64975
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The context path should be fetched using ${pageContext.request.contextPath}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic