This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
aruna sameera wrote:there are no pacage statement but still not working?
That's what Bauke is pointing out. Put your servlet into a package and then change the web.xml to reflect the complete i.e. fully qualified name of the servlet class...
Ryan Beckett
Ranch Hand
Joined: Feb 22, 2009
Posts: 192
posted
0
I had that same problem with my JSP page. It worked when I put my beans in a package.
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12269
1
posted
0
The reason is that if the JVM trys to load a class not in a package, it looks in the "current" directory. In the servlet environment you have no control over the "current" directory, therefore ALL classes used in servlets MUST be in packages to avoid strange errors.
There are environments wherein packageless servlets work (combination of certain appserver implementation/version and certain JVM implementation/version), but you should never make your application dependent on that. Put classes in packages, period. Only then the other classes can import them.