answersLogoWhite

0


Best Answer

A JSP is typically oriented more towards displaying information, and a servlet is more oriented towards processing information. For example, a JSP might display a report, while a servlet would process a user submitted form. These uses are not exclusive, but they are optimized more for performing tasks in this manner. It is much easier to incorporate HTML coding into a JSP than a Servlet. It is also easier to write more complex Java code in a servlet.

AnswerJSP has Implicit objects and Servlets do not. AnswerJSP and Servlet both define the server end functionality to provide dynamic outputs ,As we know our HTML is only the client end technology version which runs on client browser. JSP and Servlet differ each other in terms of represntation and execution cycle. Servlet are full functional java codes that define the output like write to stream files in protocol defined ways, JSP on the other hand is Role Sepated format to do so where a ordinary web designer designes how will be the presentation of the data and Programmer defines the functinality to provide the underlying things represented in conditional and non conditinal ways , But here is the magic of JSp that merges the both HTML represntation mixed with JAVA scriptlets.

Look at http://www.jsptube.com/jsp-tutorials/jsp-introduction.html, it explains how does JSP differs from servlet.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

NHope

Lvl 4
4y ago

Key differences: Implementation. Servlet is developed on Java language. JSP is primarily written in HTML language although Java code could also be written on it but for it, JSTL or other language is required.

MVC: In contrast to MVC we can state servlet as a controller which receives the request process and send back the response. On the other hand, JSP plays the role of view to render the response returned by the servlet.

Request type: Servlets can accept and process all type of protocol requests. JSP on the other hand is compatible with HTTP request only.

Session Management: In Servlet by default session management is not enabled, the user has to enable it explicitly. In JSP session management is automatically enabled.

Performance: Servlet is faster than JSP. JSP is slower than Servlet because first the translation of JSP to java code is taking place and then compiles.

Modification reflected: Modification in Servlet is a time-consuming task because it includes reloading, recompiling and restarting the server as we made any change in our code to get reflected. On the other hands JSP modification is fast as just need to click the refresh button and code change would get reflected.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between JSP and Servlets?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Basic Math

How you can display servlet page in jsp page?

You cannot. You display JSP Pages using the help of Servlets. Servlets are of the background classes and you cannot display them


Is it mandatory to learn servlets before JSP?

No. But, knowledge of Servlets would be an added advantage if you are learning JSPs


What is difference between servlets and java server pages?

SERVLETS JSP 1. Servlet is a java class. 2. Servlet is a single instance multiple thread web application, In which HTML code can be included in java code. 3. In servlets the presentation logic and the B.logic is tightly coupled. 4. For every modification done in servlet program, we need to recompile and reload the application. 5. In servlets implicit objects are not available. 6. Servlets are supported to HTTP, FTP, and SMTP protocols. 7. Sevlets are need Deployment Descriptor file (web.xml) 1. Jsp is a file. 2. In jsp java code can be included in HTML code by using special tags. 3. In jsp's the presentation logic and B.logic are separated by defining the java beans. 4. If any modifications done in jsp's without recompiling and reloading , the modifications are reflected. 5. In jsp's implicit objects are available which is we can implement directly into jsp pages. 6. Jsp are supported to HTTP protocol only. 7. No need of Deployment Descriptor file (web.xml) rajus_1219@yahoo.co.in


Difference between ASP and JSP?

The main difference between ASP and JSP is that JSP is more script like and includes Java, whereas ASP does not. Both of these are server side languages.


Is it necessary to learn advanced java for JSP?

It is a good to know item. It is not mandatory or necessary. Basic knowledge of core Java is enough to learn JSP and Servlets.

Related questions

What is the difference between PHP and struts?

STRUTs is a framework of technology of java based on JSP/Java Servlets PHP is another server scripting language


Can you create web forums using jsp and servlets?

Yes. All sorts of web Applications/websites can be created using JSP and Servlets


How you can display servlet page in jsp page?

You cannot. You display JSP Pages using the help of Servlets. Servlets are of the background classes and you cannot display them


Is it mandatory to learn servlets before JSP?

No. But, knowledge of Servlets would be an added advantage if you are learning JSPs


Create a table using JSP Servlets?

scope of operater


What is the latest version of servlet specification?

Servlets 3.0 and JSP 2.1


What is difference between servlets and java server pages?

SERVLETS JSP 1. Servlet is a java class. 2. Servlet is a single instance multiple thread web application, In which HTML code can be included in java code. 3. In servlets the presentation logic and the B.logic is tightly coupled. 4. For every modification done in servlet program, we need to recompile and reload the application. 5. In servlets implicit objects are not available. 6. Servlets are supported to HTTP, FTP, and SMTP protocols. 7. Sevlets are need Deployment Descriptor file (web.xml) 1. Jsp is a file. 2. In jsp java code can be included in HTML code by using special tags. 3. In jsp's the presentation logic and B.logic are separated by defining the java beans. 4. If any modifications done in jsp's without recompiling and reloading , the modifications are reflected. 5. In jsp's implicit objects are available which is we can implement directly into jsp pages. 6. Jsp are supported to HTTP protocol only. 7. No need of Deployment Descriptor file (web.xml) rajus_1219@yahoo.co.in


Why servlet is faster than jsp?

The speed difference is not usually significant, but the slight performance advantage goes to Servlets because, JSPs get converted to Servlets before execution and since Servlets do not have this conversion phase, they are a little and I mean only slightly little faster than JSPs


Can you use jsp and servlets together?

Yes, JSP (JavaServer Pages) and Servlets can be used together in a web application. Servlets handle the business logic and processing of requests, while JSP is used to create the user interface and generate dynamic content. Servlets can interact with JSP pages to pass data and control the flow of the application.


Difference between ASP and JSP?

The main difference between ASP and JSP is that JSP is more script like and includes Java, whereas ASP does not. Both of these are server side languages.


How do you proove servlets are faster than JSP?

because JSP internally changes in servlet and then follow servlet life cycle, so it is slower than servlet


Is it necessary to learn advanced java for JSP?

It is a good to know item. It is not mandatory or necessary. Basic knowledge of core Java is enough to learn JSP and Servlets.