users@glassfish.java.net

Re: servlet: try ... finally {out.close();} <-bad idea?

From: Witold Szczerba <pljosh.mail_at_gmail.com>
Date: Sun, 30 May 2010 19:46:10 +0200

2010/5/30 Hassan Schroeder <hassan.schroeder_at_gmail.com>:
> Servlet:
>
> Customer customer = Customer.find(customerId);
> request.setAttribute("customer", customer);
> RequestDispatcher rd =
> this.getServletContext().getRequestDispatcher(someViewPage);
> rd.forward(request, response);
>
> JSP (someViewPage):
>
> <p>Hello, ${customer.firstName}</p>
>
> That's HTML, but you can as easily format as XML, JSON, whatever.
> The container is responsible for interpreting it and writing the response.

OK, JSP is for template-based response, and every container is
supposed to handle it. How about something else like FreeMarker? Or
anything non-template-based like JAXB or my own marshaller? The
container is not going to help with that, request dispatcher is not
going to forward to such a marshaller, is it?