是否可以在网络流上下文中访问价值捆绑包属性

是否可以在网络流上下文中访问价值捆绑包属性

本文介绍了是否可以在网络流上下文中访问价值捆绑包属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的网络流程的一部分:

This is a part of my web-flow:

<?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"
    parent="estatGeneral" start-state="a_cargar_info">

    <attribute name="caption" value="consultaDeutesHandler.filAriadna" />

    <action-state id="a_cargar_info">
        <evaluate expression="consultaDeutesHandler.primeraCarrega(flowRequestContext, usuari)"></evaluate>
        <transition on="success" to="v_formulariDeutesInici"/>
        <transition on="error" to="error"/>
    </action-state>

我想从属性包或支持bean的文本中插入文本.我尝试过:

I would like to insert text from a properties bundle or backing bean into an attribute. I tried this:

<attribute name="caption" value="consultaDeutesHandler.filAriadna" />

其中,consultaDeutesHandler.filAriadna是一个返回String的函数.而不是期望值,我只是从字面上看到"consultaDeutesHandler.filAriadna".

where consultaDeutesHandler.filAriadna is a function that returns a String. Instead of the expected value I just see "consultaDeutesHandler.filAriadna" literally.

是否可以通过属性束设置属性值?

Is there a way to set the value of an attribute from a properties bundle?

推荐答案

<attribute>标记将不起作用,因为它仅支持纯字符串,而不支持EL表达式.

The <attribute> tag will not work since it only supports plain strings, not EL expressions.

<set>应该可以解决问题:

<set name="flowScope.caption" value="consultaDeutesHandler.filAriadna()" />

(将requestScope,conversationScope等替换为flowScope).

(Substitute requestScope, conversationScope, etc. for flowScope as appropriate.)

您稍后可以在流xml中以及从视图中引用此值.对于一个JSF示例,

You can refer to this value later in the flow xml, and from your views. For a JSF example,

<div>#{caption}</div>

最终将包含从consultaDeutesHandler.filAriadna()

这篇关于是否可以在网络流上下文中访问价值捆绑包属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 19:53