answersLogoWhite

0

Which one is faster servlet OR jsp?

Updated: 9/11/2023
User Avatar

Wiki User

15y ago

Best Answer

Servlet is more faster than JSP, but JSP is more convenient than Servlet and JSP is clearly superior, shorter, simple and easier to use. JSP can be perceived as Java in HTML code. JSP require no explicit compilation as like servlets and can keep in the web application server as HTML file. The web application server in turn compile the java code in JSP and load it in its library for future execution. Servlet can be perceived as HTML in Java code. The servlet is the class file, which would be loaded in the web application server as a program. The program output will be directed to the outstream object which in turn direct to the client as HTML elements.

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Which one is faster servlet OR jsp?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Algebra

When do you use JSPs as opposed to Servlets?

JSPs and Servlets can be used interchangeably for the most part. In fact, when a JSP is compiled, it is actually turned into a servlet! That being said, there are some guidelines for using servlets over JSPs or vice versa. Here are a couple of examples, but by no means a complete list: Typically, you would use a JSP to display dynamic data, or a form. A Servlet is usually what you would want to use to process a post or a get, especially considering the method that is called when you call a servlet (either doGet or doPost). For more information on this, here is a good article on Servlet and JSP Best Practices: http:/java.sun.com/developer/technicalArticles/javaserverpages/servlets_jsp


What is java servlet chaining?

Servlet Chaining means the output of one servlet act as a input to another servlet. Servlet Aliasing allows us to invoke more than one servlet in sequence when the URL is opened with a common servlet alias. The output from first Servlet is sent as input to other Servlet and so on. The Output from the last Servlet is sent back to the browser. The entire process is called Servlet Chaining.


What is the difference between RequestDispatcher.forward and HttpServletResponse.sendRedirect?

In send Redirect whenever the client makes any request it goes to the container, there the container decides whether the concerned servlet can handle the request or not. If not then the servlet decides that the request can be handle by other servlet or jsp. Then the servlet calls the sendRedirect() method of the response object and sends back the response to the browser along with the status code. Then the browser sees the status code and look for that servlet which can now handle the request. Again the browser makes a new request, but with the name of that servlet which can now handle the request and the result will be displayed to you by the browser. In all this process the client is unaware of the processing.


What is the difference between networking and servlet in java?

Networking is a basic action. A servlet in Java is a single part of networking, a single task.


What is the difference between JSP and JSPX?

http://diaryproducts.net/about/programming_languages/java/convert_jsp_pages_to_jsp_documents_jspx_with_jsp2x

Related questions

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


Which is faster among servlets and jsp?

Both are similar to one another technology wise and finding out which is faster is not possible. Ideally speaking a JSP once compiled and deployed in a web server behaves like a servlet.


How do you import jsp file in servlet?

I think the name of the jsp file is included in the web.xml of the servlet


How do you call a Servlet from JSP?

I have created a .jsp file, in which, I am calling a class.method() through TagLib. REQUIREMENT is, I want to call a servlet instead of a simple class. And Servlet will get the response, and request object from Jsp, and manipulate that, and produce the response object, and control is transfered back to JSP again.


Why donot you have doget in jsp also?

Because the doGet is the work of the Servlet and not the JSP


How do JSP methods get translated to Servlet methods?

A JSP gets converted into a Servlet for execution and hence the methods in a JSP are similar to the ones in a Servlet.Scriptlets and Expressions will end up in the body of doGet or doPostDeclarations will end up as instance variablesjspInit() and jspDestroy() will get translated to Servlet's init() and destroy() methods


Can insert javascript coding in servlet?

No. Javascript code can be present inside a JSP but not inside a servlet. A Servlet is a pure java class.


What is the difference between requestgetattribute and requestgetParameter in JSP?

request.getAttribute() is used on the Server side Java code to get values submitted from the form onto the Servlet or other java classes request.getParameter() is used on the JSP page to get values sent by the servlet and display it in the jsp page


What is different between jsp and servlets?

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.


What is the latest version of servlet specification?

Servlets 3.0 and JSP 2.1


How do you get the image file from the database with JSP?

You can retrieve an image file from a database in JSP by writing a servlet that fetches the image from the database and streams it to the JSP page. The servlet will set the content type to "image/jpeg" or the appropriate image format and write the image data to the response output stream. In the JSP page, you can then display the image by setting the source attribute of the img tag to the servlet URL.


What is the difference between JSP and Servlets?

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.