El 可以从JSP访问flowScope条目吗?(“在org.springframework.webflow.core.collection.LocalAttributeMap”类型上找不到“Property…”

El 可以从JSP访问flowScope条目吗?(“在org.springframework.webflow.core.collection.LocalAttributeMap”类型上找不到“Property…”,el,spring-webflow,El,Spring Webflow,我正在学习Spring和webflow,我遇到了一些似乎应该很简单的问题。我的流正在捕获一个查询字符串参数,并在流开始时将其存储在流作用域变量中。我正试图在第一个视图状态中回显它。错误接踵而至 以下是流定义: <?xml version="1.0" encoding="UTF-8"?> <flow xmlns="http://www.springframework.org/schema/webflow" xmlns:xsi="http://www.w3.org/2001

我正在学习Spring和webflow,我遇到了一些似乎应该很简单的问题。我的流正在捕获一个查询字符串参数,并在流开始时将其存储在流作用域变量中。我正试图在第一个视图状态中回显它。错误接踵而至

以下是流定义:

<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/webflow
        http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">
    <on-start>
        <set name="flowScope.foo" value="requestParameters.fubar" />
    </on-start>
    <view-state id="step1" view="../jsp/step1.jsp">
        <transition on="next" to="step2" />
    </view-state>
    <view-state id="step2" view="../jsp/step2.jsp">
        <transition on="next" to="step3" />
        <transition on="prev" to="step1" />
    </view-state>
    <view-state id="step3" view="../jsp/step3.jsp">
        <transition on="prev" to="step2" />
        <transition on="next" to="done" />
    </view-state>
    <end-state id="done" view="endView" />
    <end-state id="cancelled" view="../jsp/cancelledView.jsp" />
    <global-transitions>
        <transition on="cancel" to="cancelled" />
    </global-transitions>
</flow>
如果我忽略了访问键“foo”的尝试,页面将显示以下输出(其中查询字符串为
?fubar=baz
):


它看起来像标识符
flowRequestContext.flowScope
确实引用了一个映射,而且它看起来确实包含我期望的键和值。。。但是,如果我试图像EL中的地图一样访问它,它将不起作用。

只需使用
${foo}
就可以访问flowscope中的所有内容$

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Step 1</title>
</head>
<body>
This is step 1
        <h1>flowRequestContext.flowScope: ${flowRequestContext.flowScope}</h1>
        <h1>flowRequestContext.flowScope["foo"]: ${flowRequestContext.flowScope["foo"]}</h1>
        <h2>${flowScope}</h2>
        <c:if test="${empty flowScope}">
            <h1>FLOW SCOPE IS EMPTY!</h1>
        </c:if>
        <c:if test="${!empty flowScope}">
            <h1>FLOW SCOPE IS *NOT* EMPTY!</h1>
        </c:if>
        <c:if test="${empty flowRequestContext.flowScope}">
            <h1>flowRequestContext.FLOW SCOPE IS EMPTY!</h1>
        </c:if>
        <c:if test="${!empty flowRequestContext.flowScope}">
            <h1>flowRequestContext.FLOW SCOPE IS *NOT* EMPTY!</h1>
        </c:if>
<form:form id="myForm">
    <input type="submit" id="next" name="_eventId_next" value="Next" />
    <input type="submit" name="_eventId_cancel" value="Cancel" />
</form:form>
</body>
</html>
javax.el.PropertyNotFoundException: Property 'foo' not found on type org.springframework.webflow.core.collection.LocalAttributeMap
    javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:223)
    javax.el.BeanELResolver$BeanProperties.access$400(BeanELResolver.java:200)
    javax.el.BeanELResolver.property(BeanELResolver.java:311)
    javax.el.BeanELResolver.getValue(BeanELResolver.java:85)
    javax.el.CompositeELResolver.getValue(CompositeELResolver.java:67)
    org.apache.el.parser.AstValue.getValue(AstValue.java:169)
    org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
    ...
This is step 1
flowRequestContext.flowScope: map['foo' -> 'baz', 'viewScope' -> map[[empty]]]
FLOW SCOPE IS EMPTY!
flowRequestContext.FLOW SCOPE IS *NOT* EMPTY!