I just want to ask an opinion, which are the best practice to use html between this two option:
1) Use JSP by creating html page there
2) Generate html using Java server side by using PrintWriter
Which one are the best practice?
And if I got some situation like only to generate small line of html, is it better to create JSP page or just generate it using Java PrintWriter
?
Or there are any better approach?
Thanks!
response.getWriter().println("OK")
, Java 1.8 , just for generate the form based on selected user optionWriter
of a JSP directly. JSP is some kind of Template so text like "OK" should placed directly into the JSP. Accessing the writer may be interesting if you want to copy data (may be HTML) into the JSP, otherwise use the features of the (standard) tag libs and the JSP features.