Can I work with Java EE without using JSP?

0

My doubt is that if I can work javaEE without using JSP, because what I have read JSP is like a template where you specify html tags along with java code, I understand that we can work without JSP, because we directly we can implement the servlets in a java class, I understand that JSP appeared to make life easier for the programmer, but, my question is, when a servlet is going to give an answer, does JSP need to visualize the answer? or not? since JSP itself is an html document but with java code

    
asked by Jorge Luis Dircio 27.02.2018 в 07:51
source

1 answer

1

A JSP is really just a servlet: The JSP code is first transformed to a java class that extends from HttpServlet and then compiled like any other normal class. Therefore, when a servlet (the controller) delegates the generation of the HTML (or any other output) to a JSP, it does no more than delegate to another servlet.

So you can not use that technology and create the responses of your application using anything else, from a simple JSON serializer to templates such as Thymeleaf or Freemarker, PDF document generators ... or simply, from the same servlet, generate a String or an array of bytes and send it in the response.

    
answered by 27.02.2018 / 11:00
source