File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why service method doesn't run?

 
anarkali perera
Ranch Hand
Posts: 237
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


when i run this it gives

ctor
init
doGet

as result.Why service method doesn't run?
 
Paul Clapham
Sheriff
Pie
Posts: 20196
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See my answer on your crosspost.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've copied Paul's answer below and removed the other post.
Paul Clapham wrote:Some other method named service() with different parameters will have run.

 
Praneeth Thiruveedhula
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
in your program that service method is just like normal method.that method does't contain any parameters and does't throws any exception. so that is just like normal method. bydefault that method won't executes,and you have to call explacitly.

if you wrote the service method as follows then it may executes bydefault.

public void service(ServletRequest request,ServletResponse response)throws ServletException
{
System.out.println("javamirchi");
}

 
Ashwin Bangar
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the service method you have written is an ordinary method and wont be called by the servlet container.
it is as if you have given a return type to constructor and hoping it to execute when you follow an object creation process.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic