JSF - Richfaces,处理提交的表单数据然后确认继续或取消
我想显示一个确认对话框,以连续或取消提交表格时的保存操作。我有一个带有保存按钮的表单,该表格正在调用动作方法以持久形式的数据。 单击“保存”按钮时,在持续表单数据之前,将在Serveride上读取文件。文件中的数据将连接到表单数据中,然后将te表单数据持续存在。我需要从表单中的一些值来定义将读取哪些文件。到目前为止没有问题。当抛出FilenotFoundException或找不到文件中的必要数据时,我想显示一个确认对话框,以连续或取消带有消息的保存操作。
有人有一些例子或任何想法如何处理吗?我需要使用A4J吗?谢谢。 我正在使用Rifchfaces 3.3.3和SeamFramework 2.2。
I want to show a confirmation dialog to continiue or cancel a save operation when a form is submitted. I have a form with a save button which is calling an action methode to persist data in the form.
When save button is clicked, a file will be readed on serverside before the form data is persisted. Data from the file will be joined into form data and then te form data will be persisted. I need some values from the form to define which file will be readed. There is no problem so far. When a FileNotFoundException throwed or the neccessary data from the file is not found, then i want to show a confirmation dialog to continiue or cancel save operation with caused message.
Does anybody have some examples or any ideas how to handle this? Do i need to use a4j? Thanks.
I am using Rifchfaces 3.3.3 and Seamframework 2.2.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先我必须纠正我的问题标题。它不是正在“处理提交的表单数据”,而是经过验证后将提交的表单数据。
现在解决方案。
例如,我的表单中有以下内容:
一些 filelds
一个 a4j:commandButton 来重新渲染字段并执行 doSomeStuff() 操作
隐藏的 h: 或 a4j:commandButton 来提交表单。
1- 用户点击“假”提交按钮(a4j:commandButtton),
2- Ajax 调用更新 reRender 属性中的字段
3- 之后,使用重新渲染的字段值执行方法 doSomeStuff()
4- 最后 Javascript 将运行到是否提交表格。
形式:
JavaScript:
At first i have to correct my question title. It is not going on "processing submitted form data" but a form data that will be submitted after some validation.
Now the solution.
For example I have following in my form:
some filelds
an a4j:commandButton to reRender the fields and perform doSomeStuff() action
an hidden h: or a4j:commandButton to submit the form.
1- User clicks on 'fake' submit button which is an a4j:commandButtton,
2- Ajax call updates fields in reRender attribute
3- After that,method doSomeStuff() is performed with rerendered field values
4- In the end Javascript will run to submit form or not.
Form:
JavaScript:
是的,你需要使用 a4j。
尝试类似的方法(未经测试,但遵循算法):
这向您展示了如何在必要时显示模式面板。
如果没有更多代码,我无法为您提供更多帮助,但我认为这应该对您有所帮助......
Yes you need to use a4j.
Try something like that (non tested, but follow the algorithm) :
This shows you how to display a modal panel if necessary.
Without more code I can't help you more, but I think this should help you...