2

I try to find a way to access SWF special EL variables, such as a flowScope, and a custom variables, set in custom-flow.xml, from the Javascript. But I haven't find solution yet.

I am using Sping Framework 3.0, Spring WebFlow 2.0, JSP/JSTL for view.

The questions are "Is it possible?" or "Do workarounds exist?"

Thanks

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555

1 Answers1

0

It is not possible since those variables are only around while the JSP is executed on the server, when the javascript is run in the browser it has access only to what's in the returned html.

There is a workaround, what you can do is iterate flowScope in jsp code and write javascript to the html document. For each object in flowScope you output a javascript variable assignment. That way you'll embed the data in flowScope on the server in the html. It could be helpful to output it as a json structure where the global javascript variable is named flowScope and is an object with members for everything in flowScope.

In pseudo that would be someting like:

write var flowScope = {
foreach entry in ${flowScope}
    write ${entry.name} = '${entry.value}',
write }
sigget
  • 917
  • 5
  • 14