• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java Servlet interface is expected here

 
Greenhorn
Posts: 20
IntelliJ IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Experts,
I am absolutely new to Java.

I am creating a Servlet and getting the error interface is expected here.

Can you please make me understand the problem(s)?

I am using IntelliJ 14.
My Servlet code is as follows:-



Thanks in Advance.
 
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
At line 11 you have the ErpServlet implement javax.servlet.http.HttpServlet, which isn't an interface but a class. You'll need to use extends rather than implements.
 
Ranch Hand
Posts: 162
1
Android Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Line 11 should be

Also, whenever you get errors , try to decode what they are saying....

error interface is expected here. tries to convey you that Java Compiler is expecting Interface here and hence you are not using an Interface .

Also, try to use the IDE feature of creating scaffolding for you.
Not sure for how it is done in IntelliJ but the idea is to command IDE to create a Servlet and not class.
 
Indranil Sinha
Greenhorn
Posts: 20
IntelliJ IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sangel Kapoor wrote:Line 11 should be

Also, whenever you get errors , try to decode what they are saying....

error interface is expected here. tries to convey you that Java Compiler is expecting Interface here and hence you are not using an Interface .

Also, try to use the IDE feature of creating scaffolding for you.
Not sure for how it is done in IntelliJ but the idea is to command IDE to create a Servlet and not class.



Thanks Sangel Kapoor... I will keep this point in mind while coding in future.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic