Oops, I guess I should add that I was creating email messages during a batch processing operation at 1am, so this was not generated by an action, and there was no request/response object available. Otherwise the other solution with RequestDispatcher would have worked. Jason Lea wrote: Hi, I couldn't find a way to do this, other than using Jelly: http://jakarta.apache.org/commons/jelly/Which uses JEXL which is a EL processing engine, so it looks like JSP with EL. The Jelly tutorial has an example where you can call the Embedded object to process a jelly script file. Jelly scripts are not exactly the same though. I used it for creating some HTML email messages. William Stranathan wrote:The subject is prolly a poor way to say what I'm trying to say.... Does anybody know of a simple way to use JSP as an INTERNAL templating engine. For example, if I have a struts application where I'm generating an email to send, I currently have to use Velocity on the server side to put the values into the template, then send that. Is there a simple way to do the same with JSP? Would I be best served by on the server side, constructing an HTTP request to a JSP that simply pops in the request attributes into the correc place? High-level of what I want to do: ActionForward execute(mapping, form, request, response) { MyForm myform = (MyForm)form; Hashtable vals = new Hashtable(); vals.put("user",form.getUser()); vals.put("car",form.getCar()); JSPProcessor proc = new JSPProcessor(); proc.getRequestScope().put("values",vals); StringBuffer buff = proc.evaluate("WEB-INF/templates/email.jsp"); MailUtils.mail("[EMAIL PROTECTED]",buff); } Where JSPProcessor is the kind of magic I'm looking for. I don't really see anything built into the API spec, so I SUSPECT if there were anything available in Tomcat, for instance, it would be implementation specific. Not a HUGE deal, but it's kinda' a pain to have to train new folks on how to put together the JSP's AND how to put together the velocity templates. Thanks, Will --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea |
No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.7.4 - Release Date: 2005.01.25
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]