templates - What HTML templating options are there in Java as an alternative to doing HTML output from your servlet code? -


Text after "

Looking at the following Hello World Servlet, how can you keep Hello World production and any kind of out of servlet code? HTML templating format? I simply call the template from the servlet and want to render it to the Java Variable I mentioned in the template - maybe referring to the "Hello world" string as a class variable in the SprogzServlet class

 < Code> package snatch; Import java.io.IOException; Import javax.servlet.http.http. *; @SuppressWarnings ("serial") public class SprogzServlet extends HttpServlet {Public Zero doGet (HttpServletRequest request, HttpServletResponse resp) throws IOException {resp.setContentType ("text / plain"); Resp.getWriter (). Println ("hello, world"); }}  

doing this to make beautiful Java web development without using any kind of MVC It is rare for the framework (from different PDF outputs and other corner cases) that will be assigned to all the sequences for JSPs so that you are:

  • JSPs;

and ("Java Server faces") Some web frameworks are like HTML ideas with a little extra tags.

JSPs are eventually compiled just for servlets and there is a more convenient form for HTML output. Generally speaking, I use them at least in a servlet instead of writing a heap of printline () statement.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -