![](/img/trans.png)
[英]How to stop multiple browsers running on the same machine from accessing a certain web page?
[英]How to stop JSF1.2 to stop reloading same page
我正在使用JSF1.2
。
我們將打開兩個選項卡 1 和選項卡 2,並且在提交所有選項卡之前不會關閉 session。
這就是我正在嘗試的 -
然后依次提交tab1。 它將導航到指定的頁面,然后使用 tab2 數據加載 tab1 頁面。
雖然如果我打開並提交一個選項卡,那么它只會返回到定義的頁面。
我覺得這種情況正在發生,因為它在 session 中創建和保存兩個視圖數據,並且每次都檢查視圖會話。
這是我的豆子 class看起來像 -
public class testbean {
public testbean() {
initilize();
}
private void initilize() {
Map<String, Object> session =
FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
controller = getDataFromSession(session);
}
}
人臉配置.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>
我們使用自己的過濾器將數據保存到我們的 Map 中。
在特定於 Bean 的測試中。jsp將表單提交到某些 JSF 頁面,並且 JSF 頁面正在關閉 Z21D6F4540CFB521028
這很可能是由共享(=更長)scope 的頁面共享信息引起的。 您的 bean 不會導致此問題,因為它是 requestscoped 但在您共享 session 的 bean 中。
private void initilize() {
Map<String, Object> session =
FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
controller = getDataFromSession(session);
}
將其更改為在功能上和技術上都可以使用的東西將解決您的問題。
此外
我們使用自己的過濾器將數據保存到我們的 Map 中。
也可能會導致問題......所以你可能需要修復更多。 但是對於您發布的代碼,這就是答案
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.