A while ago we started to use Spring Web Flow. We needed to convert our old WizardForms and Multi SimpleFormController
screens to the Spring Web Flow ones. After converting about three jsp’s I got fed up with the hidden fields, the submit buttons with the specified name. Generating urls with a flowExecutionKey
and eventId
was even worse. Also after making al those typos in flowExecutionKey
I decided to create a taglibrary which can write different HTML tags needed in Spring Web Flow.
So after experimenting a bit I wrote three tags:
FlowExecutionKeyTag
: Writes hidden field with theflowExecutionKey
UrlTag
: Writes a url containing theflowExecutionKey
andeventId
SubmitTag
: Writes a submit button and optional a hiddenflowExecutionKey
field
FlowExecutionKeyTag
<swf:flowexecutionkey/>
will generate
<input type="hidden" name="_flowExecutionKey" value="<current_flowexecutionkey>">
UrlTag
<swf:url url="somelink.flow" eventId="read" paramName="someId" value="${someObject.id}">Link</swf:url></pre>
will generate
<a href="somelink.flow?_flowExectionKey=<current_flowexecutionkey>&_eventId=read&someId=123">Link</a>
SubmitTag
<swf:submit eventId="save" value="Save"/>
will generate
<input type="submit" value="Save" name="_eventId_save">
There are 2 JIRA issues concerning Web Flow Tags, I attached this code to one of them.
The sources can also be downloaded from here or point your favorite subversion client to the repository at http://bespring.googlecode.com/svn/.