从Java Servlet将“成功"响应发送回Acrobat Reader [英] Sending 'success' response back to Acrobat Reader from java servlet
问题描述
我正在服务器端生成可编辑的pdf表单,并将其发送到浏览器.在客户端,我正在保存pdf并添加字段并通过Acrobat Reader提交.现在,一旦servlet读取了表单字段,我就希望将成功响应发送回Acrobat Reader,让用户知道表单已成功提交.如何将响应作为Java Servlet响应发送回Acrobat Reader?
I am generating an editable pdf form at the server side and sending it to the browser. At the client side, I am saving the pdf and adding the fields and submitting it via Acrobat Reader. Now once the servlet has read the form fields, I wan to send a success response back to the Acrobat Reader letting the user know that the form has been successfully submitted. How do I send a response back to the Acrobat Reader as a java servlet response?
感谢您的帮助.
推荐答案
您希望最终用户看到什么?
What do you want the end user to see?
一些选项:
- 通常,我会发回简单的HTML,表示感谢您提交表单".归档表单后,我会向已填写的表单添加一个链接,以便人们可以检查他们填写的内容.
- 您可以返回已填写的PDF表单,但可以添加一些文档级JavaScript,以打开一个警报,提示此表单已于2014-07-21提交".如果您不喜欢JavaScript(看到这样的警报可能会很烦恼),为什么不在填写的表单上标记该消息.
- 当我不希望任何事情发生时,我向浏览器发送响应代码"204 No Content".在这种情况下,什么也不会发生.那不是您想要的,但是也许您可以返回"200 OK"或"202 Accepted".最终用户不会看到太多,但是浏览器将知道发生了什么.可在此处找到更多信息: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
在许多情况下,通常发送带有(1)中提到的链接或实际填写的PDF的邮件.
In many cases, it's common to send a mail with either the link mentioned in (1) or the actual filled-out PDF.
请注意,选项(1)仅在使用Adobe Reader/Acrobat作为插件从浏览器提交表单时才有效.当将Adobe Reader/Acrobat用作独立应用程序时,您将必须使用选项(2)或(3),因为Adobe Reader/Acrobat无法解释HTML,并且会抛出异常,表明它已接收到可以不可读.
Note that option (1) is only valid when you submit the form from a browser, using Adobe Reader / Acrobat as a plug-in. When using Adobe Reader / Acrobat as a standalone application, you'll have to use option (2) or (3), because Adobe Reader / Acrobat can't interpret HTML and will throw an exception saying that it has received content that can't be read.
这篇关于从Java Servlet将“成功"响应发送回Acrobat Reader的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!