We know that JSPs gets converted to Servlets, Servlets are for the Buisines logic and JSPs for the view etc... But theoretically, you can do most of the things you do with JSP with a servlets. Same thing the other way round.
But Is there anything that you can implement with Servlets and not with JSPs or vice versa?
I got this question some time back in an interview, but did not find any answer after lots of googling.
But Is there anything that you can implement with Servlets and not with JSPs or vice versa?
Technically, there's nothing which can be implemented by only either of them.
Functionally, there's a huge difference with regard to maintainability when you follow the MVC design pattern and implement the controller part in the servlet and the view part in the JSP. The Servlet API offers a much clearer abstraction to hook on specific HTTP methods and control the request/response before any bit is written to the response. JSP in turn is part of the response which can make some tasks harder to implement, such as changing the response in case of an exception.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With