Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP doubt  RSS feed

Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Over the past few weeks I have been trying to develop a shopping cart appl. using the MVC architecture and using Servlets, JSP and beans. My confusion stems from the fact when do I use normal Java classes and when do I use Java Beans.
For example I have written a Java Bean called Shopping Cart and used it in my JSP to display items in my cart using jsp:usebean. I could have achieved the same using a normal Java class called shopping cart and writing a scriplet in my JSP as follows:
ShoppingCart sc = new ShoppingCart();

Do let me know the pros and cons of the above two methods and when would I choose one over the other
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!