可以弹出webflow处理内部的动态表达式"评估"标签?

时间:2016-04-02 12:05:19

标签: spring spring-webflow spring-webflow-2

我在spring webflow中看到你可以为视图使用动态表达式

<view-state id="error" view="error-#{externalContext.locale}.xhtml" />

我可以做同样的评估吗?类似的东西:

 <evaluate expression="#{variable}Controller.processData()" />

提前感谢您的帮助。

2 个答案:

答案 0 :(得分:1)

这是一个想法:

<evaluate expression="webFlowUtil.getBean(variable.concat('Controller'))" result="flowScope.controller"/>

@Component
public class WebFlowUtil {

    @Autowired
    private ApplicationContext applicationContext;

    public Object getBean(String beanName) {
        return applicationContext.getBean(beanName);
    }
}

然后再使用

<evaluate expression="controller.processData()" />

答案 1 :(得分:0)

让我回答我自己的问题:不,那是不可能的。根据spring webflow的xsd:

<xsd:attribute name="expression" type="expression" use="required">

,其中

<xsd:simpleType name="expression">
    <xsd:restriction base="xsd:string"/>
</xsd:simpleType>

<xsd:simpleType name="template">
    <xsd:restriction base="xsd:string"/>
</xsd:simpleType>

根据文档,表达式应该是“模板”类型,以便进行评估。

相关问题