Use of right technology at right place I have three coding technologies javascript,jsp,servlets.

Stephen McConnell

You might want to review some discussions of what the "Model View Controller" paradigm is. That would help you greatly.

But basically it divides development into three areas the Model (Database access and business logic), View (the presentation) and the Controller ... the interface between the two. (Very rough description).

JavaScript executes in the Browser and should mainly be used for things that must happen on the client side. Iterface with the DOM in the Browser, client side validation of input, etc etc.

The JSP is also part of the View concept, but it executes on the server side and generates HTML (or other format sent across a HTTP connection to the client). It is dynamic because it can have some logic in it to modify the presentation based upon information it receives -- usually in the form of beans... It can generate the JavaScript that is going to execute on the browser side, dynamically.... But usually no business logic should occur there.

The servlet can generate HTML, but it is cumbersome, because it involves writing lots of print statements... etc etc. Usually, you think of the Servlet as the Controller. It will receive a request process it... Call BusinessObjects to perform the business logic (access databases, make decisions...) and then forward the results to a JSP which will do the presentation. It is the Controller of the whole process. It should be relatively simple....

Hopes this helps.

Stephen McConnell

About | Sitemap | Contact