• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Why service method doesn't run?

 
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


when i run this it gives

ctor
init
doGet

as result.Why service method doesn't run?
 
Sheriff
Posts: 28413
102
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See my answer on your crosspost.
 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.


 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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");
}

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic