简体   繁体   English

如何停止 JSF1.2 以停止重新加载同一页面

[英]How to stop JSF1.2 to stop reloading same page

I am using JSF1.2 .我正在使用JSF1.2

We are opening two tabs 1 and tab 2 and not closing the session until all the tabs have been submitted.我们将打开两个选项卡 1 和选项卡 2,并且在提交所有选项卡之前不会关闭 session。

This is what I am trying -这就是我正在尝试的 -

  • Opening tab 1 with some data.使用一些数据打开选项卡 1。
  • Opening tab 2 with some data使用一些数据打开选项卡 2

in sequence then Submitting tab1.然后依次提交tab1。 It's going to navigation specified page but then loading tab1 page with tab2 data.它将导航到指定的页面,然后使用 tab2 数据加载 tab1 页面。

While If I am opening and submitting one tab then it's going back to the defined page only.虽然如果我打开并提交一个选项卡,那么它只会返回到定义的页面。

I feel this is happening because it's creating and saving two views data in the session and keep checking every time for view sessions.我觉得这种情况正在发生,因为它在 session 中创建和保存两个视图数据,并且每次都检查视图会话。

This is My bean class look like -这是我的豆子 class看起来像 -

public class testbean {

    public testbean() {
        initilize();
    }

    private void initilize() {
       Map<String, Object> session = 
      FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
      controller = getDataFromSession(session);
   }

}

Face-config.xml人脸配置.xml

<managed-bean>
    <managed-bean-name>testbean</managed-bean-name>
    <managed-bean-class>com.test.testbean</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<navigation-case>
    <from-action>#{testbean.submit}</from-action>
    <from-outcome>Page4</from-outcome>
    <to-view-id>/pages/Page4Post.jsp</to-view-id>
</navigation-case>
<navigation-case>
    <from-action>#{testbean.submit}</from-action>
    <from-outcome>Page3</from-outcome>
    <to-view-id>/pages/Page3Post.jsp</to-view-id>
</navigation-case>
<navigation-case>
    <from-action>#{testbean.submit}</from-action>
    <from-outcome>Page1</from-outcome>
    <to-view-id>/pages/page1Post.jsp</to-view-id>
</navigation-case>
<navigation-case>
    <from-action>#{testbean.submit}</from-action>
    <from-outcome>Page2</from-outcome>
    <to-view-id>/pages/Page2Post.jsp</to-view-id>
</navigation-case>

We are using our own filter to save the data into Our Map.我们使用自己的过滤器将数据保存到我们的 Map 中。

In the Bean specific test.jsp submitting the form to some JSF page and that JSF page is closing session.在特定于 Bean 的测试中。jsp将表单提交到某些 JSF 页面,并且 JSF 页面正在关闭 Z21D6F4540CFB521028

This is very likely caused by the pages sharing information from a shared (=longer) scope.这很可能是由共享(=更长)scope 的页面共享信息引起的。 Your bean is not causing this since it is requestscoped but IN the bean you share the session.您的 bean 不会导致此问题,因为它是 requestscoped 但在您共享 session 的 bean 中。

private void initilize() {
   Map<String, Object> session = 
      FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
   controller = getDataFromSession(session);
}

changing this to something that works functionally and technically will solve your problem.将其更改为在功能上和技术上都可以使用的东西将解决您的问题。

In addition此外

We are using our own filter to save the data into Our Map.我们使用自己的过滤器将数据保存到我们的 Map 中。

Might also cause problems... So you might need to fix a lot more.也可能会导致问题......所以你可能需要修复更多。 But for the code you posted this is the answer但是对于您发布的代码,这就是答案

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

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