2013-10-15 18 views
1

这是我的网络流的一部分:是有可能访问在网络流上下文值包属性?

<?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> 

我想插入文本从属性捆绑或支持豆成一个属性。我尝试这样做:

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

其中consultaDeutesHandler.filAriadna是返回一个字符串的函数。取而代之的是预期值的我只看到“consultaDeutesHandler.filAriadna”的字面。

有没有办法从属性包中设置属性的值?

回答

4

<attribute>标记将不起作用,因为它只支持普通字符串,而不支持EL表达式。

<set>应该做的伎俩:

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

(替代requestScope,conversationScope等,为flowScope如适用)

您可以参考这个值在后面的XML流量,并从观点。对于JSF例如,

<div>#{caption}</div> 

最终将包含您的时间从consultaDeutesHandler.filAriadna()

+0

这个伟大的,但标题的返回值没有得到任何二传手,但TY。 – ZaoTaoBao

+0

你不应该需要一个setter。这将创建一个名为“标题”,你可以在流动XML和视图访问其他地方的流量范围的变量。 –

+0

好的,所以如果我的变量在:RequestContext ctx \t \t \t ctx.getActiveFlow()。getCaption(),我该怎么做呢? TY。 – ZaoTaoBao