我创建了一个简单的crud jsf项目.我的页面包含dataTable,并且它被填入了表格数据库.有时,我的程序不能运行,特别是在3或4个请求之后.例如,我遇到了一个场景,就像这样.当我多次触发我的selectOneMenu时(例如:13-14次),我看到DevTools控制台屏幕给出了错误信息。每当我多次触发我的selectOneMenu时(例如:13-14次),我看到DevTools的控制台屏幕给出了错误信息:"我的程序没有运行。
<p:selectOneMenu id=studentNo"
value="#{myBean.studentNo}" style="width:150px">
<p:ajax listener="#{myBean.onStudentChange}"
update=":formTabInvoiceList:tabViewInvoiceList:StudensList:table-wrapper"/>
<f:selectItem itemLabel="Choose student number" itemValue="#{null}" noSelectionOption="true" />
<f:selectItems value="#{myBean.studentNumbersList}" />
</p:selectOneMenu>
错误是:
<partial-response>
<error>
<error-name>
javax.faces.application.ViewExpiredException
</error-name>
<error-message>
/xhtml/pages/Invoice.xhtmlNo saved view state could be found for the view identifier:
/xhtml/pages/Invoice.xhtml
</error-message>
</error>
</partial-response>
我在DevTools的网络选项卡上发现了这个错误.我发现这个错误在我的程序上又重复出现了。
我上网搜索了一下,找到了一些解决方案,但我没有解决它。
<context-param>
<param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
<param-value>false</param-value>
.
另外,我检查了我的xhtml文件中的所有组件,以找到具有相同id的组件,所有组件都有不同的id,我的primeFace版本是:3.4.1。
我的primeFace版本是:3.4.1。
myFaces : 2.1.10
你有什么办法吗?
我的web.xml文件是:
<context-param>
<param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.EXPRESSION_FACTORY</param-name>
<param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Production</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
<param-value>1</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
<param-value>true</param-value>
</context-param>
我通过添加这些行解决了我的问题。
<context-param>
<param-name>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
<param-value>40</param-value>
</context-param>