Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > calling a servlet in tomcat

Reply
Thread Tools

calling a servlet in tomcat

 
 
royG
Guest
Posts: n/a
 
      11-20-2008
forgive me if this is a silly doubt.But i am a newbie to tomcat

I was trying out the examples in chapter2 of java servlet&JSP cookbook
by Bruce W. Perry.The section of 'Deploying an Individual Servlet on
Tomcat' tells to
1.create a servlet (i made cookbook.SampleServlet.java that has doGet
(..) method taking user input into some textfields and a doPost(..)
that prints those input values) .
2.copy the cookbook/SampleServlet.class into webapps/ROOT/WEB-INF/
classes directory of tomcat
3.start tomcat by running startup.bat

but then the book says,the servlet can be invoked by
http://localhost:8080/servlet/cookbook.SampleServlet

I tried that,but am getting 404 error!
How can i call the servlet ? I know how to do it thru web.xml using
urlpattern .But i want to invoke this by calling the Servlet name
directly.
Pls help..
thanks
roy
 
Reply With Quote
 
 
 
 
Jan Thomä
Guest
Posts: n/a
 
      11-20-2008
On 2008-11-20 17:45:49 +0100, royG <(E-Mail Removed)> said:

> How can i call the servlet ? I know how to do it thru web.xml using
> urlpattern .But i want to invoke this by calling the Servlet name
> directly.



I am not sure if what you ask is possible. Afaik you always need a
web.xml to map your servlet to an URL...


Jan

 
Reply With Quote
 
 
 
 
Owen Jacobson
Guest
Posts: n/a
 
      11-20-2008
On Nov 20, 11:45*am, royG <(E-Mail Removed)> wrote:
> forgive me if this is a silly doubt.But i am a newbie to tomcat
>
> I was trying out the examples in chapter2 of java servlet&JSP cookbook
> by Bruce W. Perry.The section of 'Deploying an Individual Servlet on
> Tomcat' tells to
> 1.create a servlet (i made cookbook.SampleServlet.java that has doGet
> (..) method taking user input into some textfields and a doPost(..)
> that prints those input values) .
> 2.copy the cookbook/SampleServlet.class into webapps/ROOT/WEB-INF/
> classes directory of tomcat
> 3.start tomcat by running startup.bat
>
> but then the book says,the servlet can be invoked byhttp://localhost:8080/servlet/cookbook.SampleServlet
>
> I tried that,but am getting 404 error!
> How can i call the servlet ? I know how to do it thru web.xml using
> urlpattern .But i want to invoke this by calling the Servlet name
> directly.
> Pls help..
> thanks
> roy


Because it's a potential security risk, Tomcat no longer deploys the
invoker servlet (which used to handle ROOT/servlet/*) by default. Set
up a proper webapp with a web.xml file and deploy your servlet that
way.

-o
 
Reply With Quote
 
royG
Guest
Posts: n/a
 
      11-20-2008
On Nov 20, 11:13*pm, Owen Jacobson <(E-Mail Removed)> wrote:
> Because it's a potential security risk, Tomcat no longer deploys the
> invoker servlet (which used to handle ROOT/servlet/*) by


thanks guys for the replies
Roy
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tomcat ssl servlet to servlet, private CA edavid3001@gmail.com Java 0 10-06-2005 09:03 PM
seeking servlet "Master" keep getting "Master/servlet/Master" not found. Tomcat 5.0.25 Doug McCann Java 1 08-05-2004 09:16 PM
Servlet question(Tomcat, web.xml, servlet-class, servlet-name) circuit_breaker Java 2 04-04-2004 03:26 AM
Tomcat running under apache/mod-jk hangs after calling HelloWorld servlet exactly 9 times Java 0 01-18-2004 01:24 PM
Tomcat: POST from one servlet or internal class to another servlet Sean Clarke Java 1 01-07-2004 02:22 PM



Advertisments