【问题标题】:No saved view state could be found for the view identifier找不到视图标识符的已保存视图状态
【发布时间】:2012-05-19 02:21:06
【问题描述】:

当我在 Jetty 服务器上运行我的 JSF 应用程序时,它运行良好。

但是当我把它移到 Weblogic 服务器时,它开始给我这个错误。

javax.faces.application.ViewExpiredException: /wsListing.xhtmlNo saved view state could be found for the view identifier: /wsListing.xhtml
at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:132)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:170)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:226)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:124)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3402)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2140)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2046)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1398)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)

wsListing.xhtml 如下:

  <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui" xmlns:lang="en">

<f:view xmlns:c="http://java.sun.com/jstl/core"
    xmlns:s="http://www.springframework.org/tags"
    xmlns:form="http://www.springframework.org/tags/form">
    <h:head>
        <h:outputStylesheet library="css" name="../resources/css/style.css"
            target="head" />
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>Test Client</title>
        <link rel="shortcut icon" href="../resources/images/favicon.ico" />
        <link rel="stylesheet" href="../resources/css/style.css"
            type="text/css" media="all" />
    </h:head>
    <h:body>
        <ui:include src="header.xhtml" />
        <div id="home-training-container">
            <h:form>
                <table align="center" border="1">
                    <tr>
                        <td><h:commandLink value="First Web Service"
                                action="#{wsListingBean.action}">
                                <f:setPropertyActionListener
                                    target="#{wsListingBean.webServiceId}" value="abcService" />
                            </h:commandLink></td>
                    </tr>
                    <tr>
                        <td><h:commandLink value="Second Web Service"
                                action="#{wsListingBean.action}">
                                <f:setPropertyActionListener
                                    target="#{wsListingBean.webServiceId}" value="filterabc" />
                            </h:commandLink></td>
                    </tr>
                    <tr>
                        <td>Third Web Service</td>
                    </tr>
                    <tr>
                        <td>Fourth Web Service</td>
                    </tr>
                    <tr>
                        <td>Fifth Web Service</td>
                    </tr>
                </table>
            </h:form>
        </div>
        <ui:include src="footer.xhtml" />
    </h:body>
</f:view>
</html>

当我点击任何命令链接时,就会出现这个问题:

<h:commandLink value="First Web Service"
                                    action="#{wsListingBean.action}">
                                    <f:setPropertyActionListener
                                        target="#{wsListingBean.webServiceId}" value="abcService" />

有人知道这个视图状态是什么吗?

【问题讨论】:

  • SAM——这有什么好运气吗?如果是这样,请使用分辨率更新此内容,以便其他人可以从答案中受益。谢谢。

标签: jsf-2 weblogic myfaces


【解决方案1】:

您是否将 web.xml 中的 PROJECT_STAGE 设置为 Development?如果是这样,您能否将其切换到生产环境并查看问题是否消失?我在 WebLogic 上收到了类似的错误消息(如果不一样的话),并相信该更改已修复它。

【讨论】:

    【解决方案2】:

    我在 web.xml 中加入了以下几行来修复错误

        <context-param>
        <!--description>
            The location where state information is saved. Valid values
            are 'server' (typically saved in HttpSession) and 'client'
            (typically saved as a hidden field in the form. Default is
            server.
            </description-->
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>server</param-value>
    </context-param>
    <context-param>
        <!--description>
            Number of Views to be stored in the session when Server-Side
            State Saving is being used. Default is 20.
            </description-->
        <param-name>
            org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION
        </param-name>
        <param-value>20</param-value>
    </context-param>    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-09-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多