Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Design Question - JSP- Bean + Servlet

Status
Not open for further replies.

foramit

MIS
Nov 13, 2002
7
US
I am trying to understand what is the best design approach for my application - that will be mainly ding entry of data thru JSP Pages, and retriving Data.
My questions specifically is.

I am using tomcat Connection pooling.

1. Where should I place my code that does context Lookup? I read somewhere that Doing a Context Lookup can be expensive.
Should it be in JavaBean or a Servlet ? and why ?
I am not very clear on Javebean and Servlet concept.. If someone can describe in simple language will appreciate.


2. When should I use Bean instead of Servlets?

Thanks A lot.
 
Context lookups are not expensive.

Access to databases shoud ideally be controlled via some kind of "DataBaseHelper" class.

You might want to look at the MVC[2] methodology - it would suit a data entry site quite well.

You would have a set of data that is needed to be entered - lets call it "adress details".

A bean has getter and setter methods, and values for address lines, post codes, etc.
A JSP captures that data, and populates a bean.
Perhaps you post to a servlet that checks the bean's data is OK, and then if OK, saves it in a db, and if not OK, tells the user which fields/data is missing or invalid.

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top