• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I access a servlet not mapped in web.xml

 
Ali Ekber
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Say I have a servlet called TestServlet in package com.abc.servlet. If this servlet is not defined in web.xml, how do I access it on the browser? I tried http://localhost/com.abc.servlet.TestServlet, but didn't work. Thx.
 
abhijit Ohal
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your using Tomcat webserver then it is possible because Tomcat get absolute path of its web application
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that URL should be http://localhost:8080/servlet/com.abc.servlet.TestServlet, but make sure the InvokerServlet is enabled (and for reasons explained on that page you really shouldn't use it).
 
Zein Nunna
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ali,

I think Ulf is right, i) you have to enable the invoker servlet, and ii) my path is as follows:

http://localhost/servlet/Tests.TestServlet

Tests is a package, TestServlet is the actual servlet class. I think '/servlet' can be viewed as the 'classes' directory - if that makes any sense.

Good luck, Zein
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Though be aware that using the Invoker for anything other than quick-and-dirty testing is strongly discouraged.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!