I'm just trying to get started with Java EE and related concepts. However, I'm having some trouble understanding the relations between some technologies and the roles they play.
As far as I understand, a Java EE Servlet is a Java class that runs inside a server, and generates responses to requests (typically HTML responses to HTTP requests, though Servlets can theoretically serve any protocol).
My questions:
Thanks for helping me get started!
Servlets are still used as the basis for web frameworks (though many are moving to netty now). Jsp is less useful unless you have to work with old code, newer templating frameworks are just better.
A servlet is a Java programming language class used to extend the capabilities of servers that host applications accessed by means of a request-response programming model. Although servlets can respond to any type of request, they are commonly used to extend the applications hosted by web servers.
One of the original Java web technologies, JSP is still widely used with servlets and JSTL.
When not using a MVC framework like JSF, Spring MVC, Struts, etc, you still need a servlet to do the basic request/response controlling job. The JSPs -while under the covers indeed being compiled to servlets- should be used as view only, not as controller.
I think your confusion is caused by the relatively huge amount of low quality tutorials about servlets where they are been used to print plain HTML by out.print()
statements. This is in view of MVC utterly wrong. I'd suggest to start at our wiki page: https://stackoverflow.com/tags/servlets/info
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