-
Beans vs Servlets
I just started reading an older book on servlets but i haven't read into it that far. Maybe the first three chapters. I was wondering if anyone one can tell me what is the difference between a bean and a servlet and are there different advantages to using one over the other?
The servlet examples in the book generate html via println statements which according to another book i read on jsp is no longer acceptable. I can see why for various reasons but some of the servlet examples shown do things i havent seen done with beans such as read parameters out of web.xml files.
-
Re: Beans vs Servlets
I have only worked with servlets my self. And not too much. But never beans. So I was googling to try to find out what it was. And i found this link. It explains servlets somehow better then I could have done my self, and it also looks at the differences between servlets and beans.
http://archives.java.sun.com/cgi-bin...&F=&S=&P=62090
Post back if you have more Qs about servlets though, and I can see if I can help you. Even if I am not a Guru on that subject.
-
Re: Beans vs Servlets
Even though it didn't get into when to use one over the other it pretty much answer the main question. What's the difference? :lol: Thanks NoteMe.
-
Re: Beans vs Servlets
Not sure if you are serious or not right now, after you added that :lol: ......:D...well, when I read it, I suddenly remembered why I never looked into Beans at all. A Bean is just a too loose consept. It can be anything, it is just that a Bean has some rules on how it is buildt.
As the text says, a bean can even be a servlet. And a servlet is a plug-in to extend the capabilities of a web server.
If you need something to be able to be invoked by a web browser. Then you have to use a servlet. If not, then you can use a bean.
Beans are more of a background "app" on the server. Your servlet can use them, but the Beans are not supposed to have any UI for the user. It is just a working horse for you on the server.
ØØ