JavaBeans are objects that hold data and provide "getter and setter" methods. Servlets are objects that reside on web servers and are called when requests are made. One of these cannot possibly replace the other.
Actually to be more specific.. I have bunch of DB calls made from JavaBeans which is nothing but simple Java methods. So my questions is why can't I put them in servlet wherever they r required & get rid of JavaBeans... what is wrong in it?
ever heard of code reuse? You're bound to need that same code at some other point sooner rather than later. Are you just going to copy and paste from one servlet to another? What if you need to make a change and forget to apply it everywhere?
triv, if i got u correctly, u just want to put your methods which are in beans into the servlets right. you can do that. but actually after MVC came into the picture, front end part in jsp, servlet as a controller and beans for methods, specially for DB calls. you can write the methods in servlets, but better to write in beans... it will be systematic. what bothers you to write methods in beans??