Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Servlet Vs Struts2 Performance

Which on would be better in performance among Servlets2.5 and Struts2.

like image 225
Hardik Mishra Avatar asked Mar 11 '11 10:03

Hardik Mishra


People also ask

Why are Servlets better than Struts?

An important conceptual difference with Servlets (and with Struts actions) is that Struts2 actions are not reused for different requests, and hence are thread safe: say, it can happen that three http requests (simultaneous or not) are served by one servlet instance; but inthat case we will still have three different ...

What is difference between Struts and Struts2?

Struts 1 requires Action classes to extend an abstract base class. A common problem in Struts 1 is programming to abstract classes instead of interfaces. An Struts 2 Action may implement an Action interface, along with other interfaces to enable optional and custom services.

What is the difference between servlet and Struts?

A Servlet is a technology and Struts is a framework which relies on or makes use of Servlets.

Are Struts still used?

Struts 2 development is still active and, as of writing this article, the newest version is 2.5. 25. If you would like to start with Struts 2, remember that minimum requirements are Servlet API 2.4, JSP 2.0 and Java 7.


2 Answers

Struts2 uses Servlets underneath.

Theoretically Servlets will be faster than Struts2, however practically you may notice almost zero difference since the bottleneck in your app is least likely to be in your web-app framework.

like image 77
npellow Avatar answered Oct 20 '22 01:10

npellow


Struts essentially means there is a default request handler, which does some pre-processing for you and then calls the individual controllers....

controllers then call the layer of models to setup the model and then in a declarative fashion (views are configurable via the struts-config) forward the request along with the value object representing the model to the views for rendering.....

this is pretty straight forward - however if you need to make full use of struts - like the forms,validation,error handling and resource bundles etc.... at the minimum, you should be able to reuse the model layer in its entirety without having to write one additional line of code - IFF - you had designed it correctly in the first place...

with more details about your application - you'll find more help...

like image 25
Ashfak Balooch Avatar answered Oct 20 '22 00:10

Ashfak Balooch