Vishwanath Krishnamurthi's blog

A blog on Java EE, clean code, open source and TDD

Spring Webflow – Tips

with one comment

Just a random list of tips – handy if you are using SWF

Passing a String in an evaluate expression:

To pass a string literal, enclose the string in single quotes ‘ ‘ as in


<evaluate expression="searchService.fetchSearchResult('hello')  result="flowScope.searchResult" />

Set a boolean 

Likewise to set a boolean value,

<set name="flowScope.isTicketAvailable" value=" 'true' "/>

Flush flow changes without restarting the server

While developing, do set, development=true as such and save yourself lots of time

<flow:flow-builder-services id="flowBuilderServices"
 view-factory-creator="viewFactoryCreator" development="true"/>


The RequestControlContext object

 On the rare cases where you need a requestControlContext in your bean, you can get hold of it by passing ‘flowRequestContext’ from the flow.

<evaluate expression="someBean.someMethod( flowRequestContext)">

public void someMethod(RequestControlContext context){ //your operation
}

The start state

During development, if you wanted to skip ahead a few states, just define the start-state in the <flow> element.

Want to trace the flow?

Its pretty simple to add a couple of methods in your listener that extends FlowExecutionListenerAdapter

@Override
 public void stateEntered(RequestContext context,
 StateDefinition previousState, StateDefinition newState) {
logger.debug("Entered State:" + newState.getId());
 }
  @Override
 public void transitionExecuting(RequestContext context, TransitionDefinition transition)
 {
 logger.debug("Executing transition:" + transition.getId());
 }

and trace the flow.

Advertisements

Written by Vishwanath Krishnamurthi

May 19, 2012 at 1:37 am

Posted in Spring

Tagged with , ,

One Response

Subscribe to comments with RSS.

  1. Spring Webflow – Tips « Vishwanath Krishnamurthi’s blog…

    Thank you for submitting this cool story – Trackback from JavaPins…

    JavaPins

    July 18, 2012 at 8:14 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: