问题
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>
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" />
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?
回答1:
The <attribute>
tag will not work since it only supports plain strings, not EL expressions.
<set>
should do the trick:
<set name="flowScope.caption" value="consultaDeutesHandler.filAriadna()" />
(Substitute requestScope, conversationScope, etc. for flowScope as appropriate.)
You can refer to this value later in the flow xml, and from your views. For a JSF example,
<div>#{caption}</div>
will ultimately contain the value returned from consultaDeutesHandler.filAriadna()
来源:https://stackoverflow.com/questions/19378014/is-it-possible-to-access-value-bundle-properties-in-web-flow-context