[英]How to forward a response to a JSF page from Backing Bean?
Im currently working in a JSF project and stuck with an issue. 我目前在JSF项目中工作,并且遇到了问题。 I have a requirement like,
我有一个要求,
I have a button. 我有一个按钮。 Clicking on the button should trigger a dojo dialog box where it will be having a "OK" and "Cancel" button along with an info message.
单击该按钮将触发一个dojo对话框,其中将带有“确定”和“取消”按钮以及一条信息消息。 Clicking on the cancel button will close the popup.
单击取消按钮将关闭弹出窗口。
Clicking on "OK" button will submit the form in javascript by calling document.formname.submit(). 单击“确定”按钮将通过调用document.formname.submit()来提交javascript表单。
The issue is the on submitting, i need to take the user to another page with the response. 问题是提交时,我需要将用户带到另一个带有响应的页面。 I mean forward not Redirect.
我的意思是转发而不是重定向。 If i use h:commandButton with action attribute, then the pop up appears and it submits the form without waiting for user action in the popup..
如果我将h:commandButton与action属性一起使用,则会出现弹出窗口,并且它将提交表单,而无需等待弹出窗口中的用户操作。
I want the fisrt button click should trigger javascript function and that "OK" should submit the form and forwards the response to another page. 我希望单击fisrt按钮可以触发javascript函数,并且“确定”应该提交表单并将响应转发到另一个页面。
Please suggest me how can i do this with my xhtml,javascript,backing bean and faces-config. 请建议我如何使用我的xhtml,javascript,backing bean和faces-config来做到这一点。 If needed i will post some sample code also.
如果需要,我还将发布一些示例代码。
As of now i have like this, 到目前为止,我已经这样
xhtml 的xhtml
<h:commandButton id="viewBtn" type="button" value="submit" onclick="submidt()"/>
js: js:
function submidt() {
var h = new dijit.Dialog({
title: "Hello"
});
var content = "<input type='button' onclick='document.searchSecurityForm.submit();' value='OK' /><input type='button' onclick='this.hide();' value='Cancel' />";
h.attr("content",content);
h.show();
}
faces-config: faces-config:
<navigation-rule>
<from-view-id>/viewpage.xhtml</from-view-id>
<navigation-case>
<to-view-id>/editpage.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
so these makes me to stay in the same page(View Page) with the response. 因此,这些使我能够与响应保持在同一页面(“查看页面”)。 I want to make the user to take to edit page.
我想让用户来编辑页面。
Thanks in advance. 提前致谢。 goG
goG
If i use h:commandButton with action attribute, then the pop up appears and it submits the form without waiting for user action in the popup..
如果我将h:commandButton与action属性一起使用,则会出现弹出窗口,并且它将提交表单,而无需等待弹出窗口中的用户操作。
return false at the end of your javascript onclick method. 在javascript onclick方法的末尾返回false。
function submidt() {
var h = new dijit.Dialog({
title: "Hello"
});
var content = "<input type='button' onclick='document.searchSecurityForm.submit();' value='OK' /><input type='button' onclick='this.hide();' value='Cancel' />";
h.attr("content",content);
h.show();
return false;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.