Given the following Hello World servlet, how could you transfer the Hello World output out of the servlet code and put it in some kind of HTML templating format? I would like to simply call the template from the servlet and have it render the Java variables I refer to in the template - perhaps by referring to the "Hello World" string as a class variable in the SprogzServlet class?
package boochy;
import java.io.IOException;
import javax.servlet.http.*;
@SuppressWarnings("serial")
public class SprogzServlet extends HttpServlet
{
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException
{
resp.setContentType("text/plain");
resp.getWriter().println("Hello, world");
}
}