在 Struts 2 中动态生成电子邮件模板 [英] Dynamically generating a email template in Struts 2

查看:31
本文介绍了在 Struts 2 中动态生成电子邮件模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

场景是用户请求休假.当他请求休假时,会向审批者和用户发送一封电子邮件,其中包含有关休假的详细信息.我在这一点上卡住了如何创建一个模板,该模板将根据请求休假的用户的姓名自动更新.我看到 asp.net 应用程序在模板中使用类似这样的东西实现

The scenario is that a user request a leave. When he request leave then a email is send to the approver and the user containing the details about the leave. I am Stuck at this Point that how to create a template which will be automatically updated by the name of the user requesting leave .I saw asp.net app in that the implemented in a template by using something like this

Requestor   :   {REQUESTORS NAME}
Leave Type  :   {REQUEST TYPE}
Start Date  :   {REQUEST START DATE}
End Date    :   {REQUEST END DATE}
Number of days  :   {DAYS REQUESTED}

任何想法如何使用 struts 2 动态创建这样的模板,任何最小的指导都会非常有帮助

Any idea how to create such a template dynamically using struts 2 any smallest of the guidance would be very helpful

推荐答案

只需使用一些模板引擎来创建模板并用您的数据填充它.看看 FreeMarker 模板引擎 http://struts.apache.org/2.x/docs/freemarker.html.Struts2默认使用,无需单独添加.

Just use some template engine to create template and populate it with your data. Take a look at FreeMarker template engine http://struts.apache.org/2.x/docs/freemarker.html. It is used in Struts2 by default so there is no need to add it separately.

这篇关于在 Struts 2 中动态生成电子邮件模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆