嵌入式JSF 2.0应用程序导航案例的问题 [英] Problems with navigation cases from an embedded JSF 2.0 application

查看:104
本文介绍了嵌入式JSF 2.0应用程序导航案例的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个JSF电子表单应用程序。此应用程序需要嵌入另一个Web站点(一个用JSP编写)。我可以嵌入这个的唯一方法是在文档准备阶段通过jQuery。

I'm working on a JSF e-form application. This application needs to be embedded in another web site (one written in JSP). The only way I can embed this is through jQuery at the document ready phase.

我已经拥有了所有需要嵌入的页面,所有内容都按预期显示但是是一个问题。

I've got all the pages I need embedded and everything is showing up as expected but there is one problem.

在我的新表单/编辑表单网页上,我有一个提交按钮,用于更新表单或在服务器端创建一个新表单,然后导航到操作完成后屏幕或故障屏幕成功。

On my new form/ edit form web page I have a submit button that updates the form or creates a new one on the server side and then navigates to the successful screen or failure screen when the action is complete.

当嵌入此页面时,此按钮仍然在服务器上执行操作(太棒了!!)但是,正如预期的那样,将页面重定向到成功屏幕。我想做的是留在父屏幕上,只需用成功页面/失败页面替换嵌入页面。

When this page is embedded, this button still executes the action on the server (awesome!!) but, as expected, redirects the page to the success screen. What I would like to do is stay on the "parent" screen and just replace the embedded page with the success page/failure page.

我想我可以走的路关于这是以某种方式从JSF拦截导航事件并从该事件重新加载嵌入页面。这里的关键是在提交后不离开父页面。

I think the way I could go about this is to somehow intercept the navigation event from JSF and reload the embedded page from that event. The key here is to not leave the parent page after a submission.

我在Tomcat 6上运行JSF2.0(Apache impl。),jQuery版本是1.3 。

I'm running JSF2.0 (Apache impl.) on Tomcat 6 and the jQuery version is 1.3.

我希望这很清楚..如果你们需要更多信息,请告诉我。

I hope this is clear.. Let me know if you guys need any more info.

谢谢!

推荐答案


当嵌入此页面时,此按钮仍然在服务器上执行操作(太棒了!)但是,正如预期的那样,将页面重定向到成功屏幕。我想做的是留在父屏幕上,只需用成功页面/失败页面替换嵌入页面。

只需返回 null void 并有条件地呈现内容。

Just return null or void and conditionally render the content.

如此

public void submit() {
    results = processAndGetIt();
}

with eg

<h:form>
    ...
    <h:commandButton value="Submit" action="#{bean.submit}">
        <f:ajax execute="@form" render=":results" />
    </h:commandButton>
</h:form>

<h:panelGroup id="results">
    <h:panelGroup rendered="#{not empty bean.results}">
        Results have been retrieved: #{bean.results}.
    </h:panelGroup>
</h:panelGroup>

请注意,我添加了< f:ajax> 为了更好的用户体验。

Note that I added <f:ajax> for better user experience.

这篇关于嵌入式JSF 2.0应用程序导航案例的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆