Reputation: 88
I have an ajax request (GET) that needs to pass an ID to retrieve details from the DB. I couldn't figure out how 'link' that ajax request to a bean method using Webflow.
The ajax function has to be plain JS/Jquery/AngularJS.
Ajax --> Webflow --> Bean Method (return details based on ID)
Any ideas?
Upvotes: 1
Views: 775
Reputation: 3198
Spring Webflow is not a good solution for what you are trying to achieve because angular js "single page app" fundamentally conflicts with SWF which requires full page refreshes per request.
but... If you are already using SWF. All registered spring @Components/@Service/etc... are accessible from within your flow.xml you can reference them by name like so:
<!-- assuming myService is the name of a registered spring bean -->
<set name="flowScope.result" value="myService.getById(requestParameters.id)"/>
You will also have to enable ajax requests (not enabled by default) with the view framework you are using: see: http://docs.spring.io/spring-webflow/docs/2.4.2.RELEASE/reference/htmlsingle/#spring-js-ajax
Also see: How to include a pop-up dialog box in subflow which explains how SWF ajax internals work
Upvotes: 1