0
votes

I am using the Grails ajaxflow plugin for creating a basic wizard. One issue I have is the controller action naming that is used by default. Specifically, let's say I have a controller named ThingController, in which the default flow is named pagesFlow. This results in a wizard url during execution as such ..

/thing/pages?execution...

Generally the wizard is intended to allow adding of 'things'. As it were, I would prefer a url that indicated such ..

/thing/add?execution...

Is there a way, either by changing the pagesFlow definition, or through custom url mapping to achieve this result?

I have briefly attempted both with no luck. The ajaxflow plugin appears to require this default naming, and tbh I don't understand url mappings well enough yet.

1

1 Answers

1
votes

I haven't used ajaxFlow specifically but I've worked with grails webflow before. Generally what you're asking for isn't possible because webflow basically manages the different "actions" like add/delete/update etc for your flow behind the scene so only the flow name "pages" is exposed.

However if you really want to have a distinct name, the only workaround I can think of is to use the subflow feature of webflow. The webflow documentation is part of the grails doc http://grails.org/doc/latest/guide/theWebLayer.html#subflowsAndConversations.

The idea is that a subflow is just another flow that you define. Flows can call another flow and have the second flow return the results back to the first flow. So in your case you would have your main flow call addFlow, updateFlow etc. Conceptually even though all of your actions belong to a single flow, there's nothing stopping you from breaking each out into its own flow. That way you can have the name of your URL reflect your actions. You could even define your subflow in a different controller as well so you can affect the controller name in the url.