• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to differentiate ordinary java class file and servlet class file?

 
jayaa mani
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

How to diffentiate java class file and servlet file?

regards
Jayaa
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A servlet extends either GenericServlet or HttpServlet.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jayaamani D.S,
Welcome to JavaRanch!

We're pleased to have you here with us in the Servlets forum, but there
are a few rules that need to be followed, and one is that proper names are
required. Please take a look at the
JavaRanch Naming Policy and
adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

You can change it here
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use reflection to find out if the class implements the javax.servlet.Servlet interface. Note that it is possible that an ordinary Java class (which is used outside of a servlet container) also implements this interface, so this test may not be foolproof for your purposes. That would be a pathological cse, though.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!