tags:

views:

358

answers:

1

Hi,

In my Grails app, I have a bean stored in flow scope under a key that is dynamically generated. In a GSP I want to retrieve the bean. Assume that the key of the bean is the current Date as a String (though it's not really).

If in my GSP I use something like

${new Date().getDateString()}

then this will render the current date, but what I want to do is retrieve the bean from flow scope with this key.

Thanks, Don

+1  A: 

I'm not sure how you'd do this exactly the way you state it. As you state, most times whatever variable held the key would just be converted to a string and displayed. During a WebFlow, everything below the session scope is flattened (including the request and flow scopes) and not referred to by scope-name.

Is there a reason they have to be put in the Flow scope directly? Would it still work for you if you put a Map in the flow scope called "storedBeans" or some such, and put your beans in the map using those generated keys? Then something like:

${ storedBeans[ generatedKeyVar ] }

should return the bean your interested in.

Bill James