hi thilak JSP was made in order to give the user a distinct method to separate the HTML (interface part) from the actual servlet methods(Actual functionality).So it depends on what you need to use. If you wantyour servlet to use HTML extensively you can go in for JSP as it saves you a lot of trouble. If on the other hand your servlet is just a pure functional unit then you may prefer to go in for the Servlet approach. The jsp format allows you to use certain objects like out,request and response so theres not much difference in what you can do with servlets and jsp . regards pranav

In fact, internally each JSP page is compiled into a servlet, so JSP is technically just a different way to create servlets. The difference mostly lies in whether you want to embed Java code in HTML (or WML, XML, whatever), or HTML code in Java. If your page is mostly concerned with presentation, you most likely want to use JSP. On the other hand, if the page mainly does some kind of processing and no or only very little presentation, a servlet might be more appropriate - or a JSP page that uses Java classes to encapsulate the processing. Often, a mixed (JSP and servlet) solution might be best. Putting a lot of Java code and little or no presentation code in a JSP page is often considered bad style, although I have worked with platforms that used JSP for both presentation and application logic. It also depends a lot on the complexity of your web application. -Mirko

Originally posted by Pranav Jaidka:hi thilak JSP was made in order to give the user a distinct method to separate the HTML (interface part) from the actual servlet methods(Actual functionality).So it depends on what you need to use. If you wantyour servlet to use HTML extensively you can go in for JSP as it saves you a lot of trouble. If on the other hand your servlet is just a pure functional unit then you may prefer to go in for the Servlet approach. The jsp format allows you to use certain objects like out,request and response so theres not much difference in what you can do with servlets and jsp . regards pranav

Another aproach is that you can use JSP pages with taglibs that are tags that you define to call java libraries, in that way you keep jsp pages separate from java code. Here is an example, you have to create 3 files or more depending of your java code. The jsp, the tag lib definition and the java class.

thilak subbiah

Greenhorn

Posts: 9

posted 17 years ago

Hi Pranav Thanks for your info. When we run JSP programs, it will be converted to Servlets.So, JSP engine will take some time for this conversion.So, performance will be reduced.In my opinion, we can directly write servlets to improve our performance. Just give our comments. Regards, Thilak.V

Originally posted by Pranav Jaidka:hi thilak JSP was made in order to give the user a distinct method to separate the HTML (interface part) from the actual servlet methods(Actual functionality).So it depends on what you need to use. If you wantyour servlet to use HTML extensively you can go in for JSP as it saves you a lot of trouble. If on the other hand your servlet is just a pure functional unit then you may prefer to go in for the Servlet approach. The jsp format allows you to use certain objects like out,request and response so theres not much difference in what you can do with servlets and jsp . regards pranav

------------------

Pranav Jaidka

Ranch Hand

Posts: 264

posted 17 years ago

hi thilak If you notice when you access your JSP page there is always a small delay when you are accessing your page for the first time .This is the time when the Servlet is actually compiled .However subsequent accesses are pretty fast(because the servlet is not compiled again .unless you change the jsp page ) and there is no difference as such between using a servlet or a JSP page from then on . Considering that you may then have no significatn advantage of using the servlet ...but The jsp code allows you to segregate your presentation and business logic .i prefer to go in for the JSP approach. ragards pranav