如何捕获JSP的当前动态输出并发送电子邮件? [英] How to capture current dynamic output of JSP and email it?
本文介绍了如何捕获JSP的当前动态输出并发送电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的web应用中,JSP页面输出到当天登录的网页的列表。我想将相同的输出邮寄到具体的邮件ids。我需要使用什么Struts2标签?
In my webapplication, a JSP page outputs to the webpage, the list of users logged in that day. I want to mail the same output to specifics mail-ids. What all Struts2 tags do I need to use?
推荐答案
使用JavaScript抓取HTML并将其作为请求参数发送。 >
Grab the HTML using JavaScript and send it as request parameter.
<div id="content">
... (here you should put content which you'd like to mail)
</div>
<form action="mail" method="post" onsubmit="html.value = encodeURIComponent(document.getElementById('content').innerHTML)">
<input type="hidden" name="html" />
<input type="submit" value="Mail this document" />
</form>
它将作为请求参数可用,名称为html
在Struts2 / Servlet端。电子邮件的工作可以通过 JavaMail 的帮助来完成。
It'll be available as request parameter with name "html"
in Struts2/Servlet side. The emailing job can be done with help of JavaMail.
这篇关于如何捕获JSP的当前动态输出并发送电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文