Access bean with dot (.) In ID

In the stream definition, I am trying to access a bean that has a point in its ID

(example: <evaluate expression="bus.MyServiceFacade.someAction()" />

However, this will not work. SWF is trying to find a bean "bus".

I initially overcame this by using a helper bean to load the required bean, but the solution is inelegant and inconvenient. Using aliases is also out of the question, since beans are part of a large system, and I cannot interfere with them.

In a nutshell, none of the solutions allowed me to directly reference the bean using its original name. Is this possible in the current release of SWF?

+7
java spring spring-el spring-webflow
source share
4 answers

I was able to do this using the bean accessor ( @ ) character and single quotes around the bean name.

Using your example: #{@'bus.MyServiceFacade'.someAction()}

+7
source share

This is an EL parser limitation (typically either OGNL or jboss-el for Spring Web Flow). EL uses dot notation to parse the navigation chain, invoking the initial behavior you described (attempting to find a bean).

+1
source share

Try:

['bus.MyServiceFacade']. SomeAction ()

or

'bus.MyServiceFacade'.someAction ()

This may work, or it may not be so ... but similar things are used in the expression language for JSP.

0
source share

In my experience, everything that is available with the getter method can be obtained through point notation. In your example, any object represented by a bus bean should have a getServiceFacade method and that the object returned by getServiceFacade should have a getSomeAction method.

-one
source share

All Articles