Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple Servlets, but only would load up

 
Omar Perez
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 207
1
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Omar Perez
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 207
1
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What was the problem?
 
Omar Perez
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20771
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


>>> int count=1;
instead
it is
>> int count=0;
right?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic