简体   繁体   English

打印Jasper报告后如何向用户显示消息

[英]How to show a message to the user after printing a Jasper Report

I have one page that should do it: 我有一页应该这样做:

  1. Process clients data 处理客户数据
  2. Generate a jasper report 生成碧玉报告
  3. Send emails to the clients 发送电子邮件给客户

I want to show user a message "Email sent correctly" or "Email not sent" 我想向用户显示一条消息“电子邮件发送正确”或“电子邮件未发送”

I search for a way extensively, but I see that this is impossible, because the response is flushed when I generate the report. 我进行了广泛的搜索,但是我发现这是不可能的,因为在生成报告时会刷新响应。

But, doing more research I found this class: ServletResponseWrapper that may be helpful, which I can change the content of the Response object. 但是,通过进行更多的研究,我发现了此类: ServletResponseWrapper可能会有所帮助,可以更改Response对象的内容。 But I don't realize how can I do this. 但是我不知道该怎么做。 So I would like some suggestions on how to use this class to do what I like (if it is possible) or maybe other suggestions to deal with this problem. 因此,我想提出一些有关如何使用此类做自己喜欢的事情的建议(如果可能的话),或者是其他建议来解决这个问题。

You can set a value the session, but you will need to compute the response in order to save it, thus refreshing the page you can use this value to show/hide a message telling whether or not the email has been succesfully sent or not. 您可以为会话设置一个值,但是您需要计算响应以保存它,因此刷新页面时,可以使用此值显示/隐藏一条消息,告知是否已成功发送电子邮件。

If you have a backing bean you can manage a boolean sent = true/false , and use ajax to refresh partially your page - a panel for example, that tells the user the outcome of the operation. 如果您有支持bean,则可以管理一个boolean sent = true/false ,并使用ajax来部分刷新页面-例如,一个面板,它告诉用户操作的结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM