• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Servlet interface is expected here  RSS feed

 
Indranil Sinha
Greenhorn
Posts: 20
IntelliJ IDE Java Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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.
 
Jelle Klap
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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.
 
Sangel Kapoor
Ranch Hand
Posts: 162
1
Android Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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 Java Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!