JSF多视图限制 [英] JSF multiple views limit

查看:111
本文介绍了JSF多视图限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个Web应用程序,该应用程序可在主页上的iFrame中打开页面.每个iFrame均可通过页面上的选项卡进行查看,并使用带有Mojarra视图状态bean的JSF2.2来填充页面.

I've created a web application that opens up pages inside an iFrame on the main page. Each iFrame is viewable via a tab on the page and uses JSF2.2 with Mojarra view state beans to populate the page.

当我打开10个标签下的内容时,此方法很好用;但是当我尝试打开更多内容时,保存第一页的bean会被破坏,并且在我对该bean进行任何调用时会重新创建,从而丢失了用户可能进行的任何先前更改.

This works fine when I open up something under 10 tabs; but when I try to open up more, the beans that held the first pages are destroyed and get recreated when I make any calls to the bean thus losing any prior changes the user may have made.

我在Catalina上使用Apache Tomcat 7,并且在我的XP和Windows Server 2008计算机上发生了此问题.

I'm using Apache Tomcat 7 with Catalina, and this issue is happening on my XP and Windows Server 2008 machines.

这是我当前的web.xml

This is my current web.xml

 <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
  <display-name>SCMPage</display-name>
  <filter>
    <filter-name>IEFilter</filter-name>
    <filter-class>com.Filter.IEFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>IEFilter</filter-name>
    <url-pattern>*.xhtml</url-pattern>
  </filter-mapping>
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
  </servlet-mapping>
  <context-param>
    <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>server</param-value>
  </context-param>
  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>resources.application</param-value>
  </context-param>
  <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
  </listener>
  <context-param>
    <description>Location of the Config file for the web application and the engine</description>
    <param-name>configFile</param-name>
    <param-value>C:\Users\ravil7148084\workspace\SCMPage\config.properties</param-value>
  </context-param>  
  <context-param>
    <param-name>com.sun.faces.numberOfViewsInSession</param-name>
    <param-value>30</param-value>
  </context-param>
  <context-param>
    <param-name>com.sun.faces.numberOfLogicalViews</param-name>
    <param-value>30</param-value>
  </context-param>
</web-app>

我也曾尝试设置此环境变量,以为可能是tomcat的内存限制,但这并没有改变

I've also tried setting this environment variable thinking that it might be a memory limit on tomcat's end, but it didn't make a difference

set JAVA_OPTS=-Dfile.encoding=UTF-8 -Xms128m -Xmx1024m -XX:PermSize=64m -XX:MaxPermSize=256m

任何帮助将不胜感激!

推荐答案

您那里只是一个严重的设计错误.要包含服务器端页面片段,您使用的是90年代样式的iframe,而不是真正的服务器端包含组件.每个iframe都有其自己的视图状态,并且不会重复使用主文档的视图状态.只需将所有<iframe>替换为<ui:include>,世界就应该很好.

You've there just a severe design error. To include server side page fragments, you're using 90's style iframes instead of true server side include components. Each iframe has its own view state and won't reuse the main document's view state. Just replace all those <iframe> things by <ui:include> and world should be well.

  • How to include another XHTML in XHTML using JSF 2.0 Facelets?
  • com.sun.faces.numberOfViewsInSession vs com.sun.faces.numberOfLogicalViews

这篇关于JSF多视图限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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