Thanks for trying out Pebble; I'd be glad to help you out!
The key thing to understand is that during the "evaluate" method, Pebble writes the output to the "Writer" object that you provide to it. Your "writer" is now holding the final output; ready for you to use it however you want. There are all sorts of different Writer implementations (see the "Direct Known Subclasses" section in
this java documentation) which allow different users to use the final output in different ways (eg. write to a file, display on a screen, send as http response, etc.). In your particular example you used a "
StringWriter" which simply stores the output and returns it as a string if you call it's "toString()" method.
You mentioned you are NOT using Spring MVC but I'm not sure exactly which technologies you ARE using so it's difficult to help much further. If you are using servlets you can obtain a "
PrintWriter" from the HttpServletResponse via it's "
getWriter()" method. If you pass this PrintWriter to Pebble as an argument to the evaluate method (instead of a StringWriter) it will write the final output directly to the HttpServletResponse which gets returned to the end user of your web application.
Hopefully that helped but let me know if I can clarify any further.
Thanks,
Mitchell