Why using Beans?
Hello,
Now, at the very beginning I'm asking what are the advantages of using beans instead on working directly with java classes (using import for example). I have an application which will use a lot of forms to access an Oracle database and I have to choose between using or not Beans. Any suggestions?
Thank you!
[349 byte] By [
ddani2000] at [2007-9-26 3:29:54]

JSPs should be presentation-centric, try to keep scriptlets to a minimum (ie. <% ... %>). You'd put most/all Java code into the bean. When done properly, the JSP will consist of mostly HTML code with a few directives, declarations, expressions, scriptlets and JSP tags (ie. <jsp:usebean ... />). If you end up with lots of Java code in a JSP then I'd wonder why you are using a JSP when a servlet-only solution would do just as well.
Hi.You are correct. Instead of using <jsp:useBean/>.you can make use of our java classes directly into jsp file using import and setting classpath for that classes.but beans has additional features like scope (session, page, request, application).
You can use regular Java objects as a bean, just avoid get/set properties. By doing this, you'll still get the scope benefits and the JSP can be presentation-centric.
If a plethora of get/set methods is your main concern, I would suggest using an IDE that creates the accessor methods for you.