wood burning stoves 2.0*
The moose likes Servlets and the fly likes Multiple Servlets, but only would load up Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Multiple Servlets, but only would load up" Watch "Multiple Servlets, but only would load up" New topic
Author

Multiple Servlets, but only would load up

Omar Perez
Ranch Hand

Joined: Jul 08, 2011
Posts: 36
Good Morning and God Bless,

Well this morning I'm coming with a small issue that I have with two Servlets, the first work like a charm, but the second is returning HTTP Status 404 from Tomcat (The requested resource () is not available.)

Here is my DD



The WebCounter Servlets is in the servlets package.
Rajdeep Biswas
Ranch Hand

Joined: Mar 26, 2012
Posts: 186

See if you have correctly compiled the servlets with package names. Reload the server, then try again.
Also see that you have specified the correct URL where it needs to be.


The biggest gamble will be to ask a question whose answer you know in that it will challenge your theory | www.TechAspire.blogspot.in
Omar Perez
Ranch Hand

Joined: Jul 08, 2011
Posts: 36
Rajdeep Biswas wrote:See if you have correctly compiled the servlets with package names. Reload the server, then try again.
Also see that you have specified the correct URL where it needs to be.


Everything seems to be written corrrectly, don't know why I'm getting the 404 error, the WebCounter.java is in the same package of BasicCounter.java.

Edit.
NVM. I just found what was wrong before.

The only trouble now is that the servlet is not using the method in the page.



The only problem now is not printing the outcome from the doubleCount method.
Rajdeep Biswas
Ranch Hand

Joined: Mar 26, 2012
Posts: 186

What was the problem?
Omar Perez
Ranch Hand

Joined: Jul 08, 2011
Posts: 36
Rajdeep Biswas wrote:What was the problem?


That I didn't add extendes HttpServlet to the WebCounter class...

However, now I need to figure out why is not printing the result from the operation in the webcount method. It's just printing "The count is now: ()".
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Omar Perez wrote:However, now I need to figure out why is not printing the result from the operation in the webcount method. It's just printing "The count is now: ()".


I would expect it to always print "The count is now: 0" -- and there's nothing anywhere in the code you posted, so either you aren't running the code you posted, or your screen is blurry and you are confusing "0" with "()".
Omar Perez
Ranch Hand

Joined: Jul 08, 2011
Posts: 36
Paul Clapham wrote:
Omar Perez wrote:However, now I need to figure out why is not printing the result from the operation in the webcount method. It's just printing "The count is now: ()".


I would expect it to always print "The count is now: 0" -- and there's nothing anywhere in the code you posted, so either you aren't running the code you posted, or your screen is blurry and you are confusing "0" with "()".


Yeah, it really looked like (), but now is fixed and working like a Charm, here is the correct servlet code. Thanks everybody for your help.

sai rama krishna
Ranch Hand

Joined: May 29, 2009
Posts: 229


>>> int count=1;
instead
it is
>> int count=0;
right?
 
Consider Paul's rocket mass heater.
 
subject: Multiple Servlets, but only would load up
 
Similar Threads
problem in deploying war file
Sessions on a servlet
tomcat execution problem and other thing
Servlet Mapping, HTTP requests, and Error Handling
Running first example of head first Servlets & JSP