الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

Organizing some long JSP file

مغلق
بدأه Aladdin11 في 26 أبريل 2003 · 2 رد · 569 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

I am working on some shopping cart. Well it is easy as you know and straightforward. Off some database table I retrieve some lines that correspond to a certain customer and then render this data in a certain format , all this is in a JSP file. My problem is that I want to make some processing on this data to add some concluded information out of it.

When I estimate the size of my shopping-cart page file, I guess it will be about 3000, 4000 or may be more.

I can divide processing into several phases, so each phase is put into a separate file, and then the shopping-cart will be a collecting of these files. What is the best way to make the communication between these files?

Should I first use a servlet that makes a part of processing, and then use another servlet for the next phase, and so on?

Should I use a java bean is a means of communication among several jsp files?

Frankly I miss OOP in JSP files if only I could use encapsulation; can anybody tell me more about getting benefit of encapsulation in JSP?

Every answer will be appreciated. Thank you for reading…

#2

The MVC (Model,View,Control) design pattern is a good way of achieving this objective.It is always better to leave JSP for presentation only in order to simplify the web design tasks.A servlet or more could be used to control the data flow from the user input to your E-commerce objects (JavaBeans).You could do some processing in the servlet code in order to identify which Business method to call ,and on which JavaBean.However, you are always advised to have a read-write proerties in your javabeans .this will allow you to change the properties of your business objects .

the MVC design pattern is exaplained here:

http://java.sun.com/blueprints/patterns/MVC.html

http://java.sun.com/blueprints/guidelines/.../app-arch5.html

http://java.sun.com/blueprints/guidelines/.../web-tier5.html

Madani

#3

Thanks a lot Madani..

May Allah bless you.

هذا الموضوع مغلق.

مواضيع مشابهة