Hi, you've reached the website of Mark Menard, Freemason, developer, businessman, photographer, motorcyclist and all around nice guy.
The main joy in my life is Sylva, my loving partner and friend. (You will see plenty of pictures of her. Also check out our site.) My professonal career is running a consulting firm concentrating on business automation and custom software. I enjoy software development, motorcycles, photography, dancing, freemasonry and travel.
Here you will find galleries of my latest photos, thoughts on software development, freemasonry, the occassional politics, and other things. Enjoy your time here.
Mark
An ongoing photographic study of Freemasonry.
To contact Mark send an email to mark@mjm.net. You will receive an auto response from my mail server to verify you're not a spammer.
© Mark Menard 2002-2007
Difficult to use with input validators
This interceptor seemed like a good idea for the use case I'm implementing in my application - a two-step user registration process. What I'm finding is that, in practice, the ConversationInterceptor is difficult to use because it is interacting badly with Struts2 input validators. It forces you to structure your input validation configuration in one specific way.
Allow me to explain further.
I started off with two action classes, two separate JSPs, and two validation.xml configuration files. The ConversationScopeAware interface has an unstated requirement that all aspects of the conversation take place within one action class, as the lifecycle of the ConversationModel is determined by the prepareConversationModel() and isConversationFinished() methods in the ConversationScopeAware interface. (I assume if I use two separate action objects, each will get a separate ConversationModel object, sort of defeating the purpose of the whole thing).
So, I refactored to put the entire conversation into one action class. Because the Struts2 validation mechanism is hardwired to go to the "input" result on any validation error, I have to combine all the user forms into one JSP as well. Furthermore, I also have to put the input validation into one .xml file.
At this point, only a subset of the input fields are displayed to the user at any step. But the Struts validator validates them all at every step, flagging non-existent fields as not having valid input.
To work around this limitation, I can implement separate methods on the action object for each step in the conversation, but I'm then forced to configure separate validation configuration files for each method in my action (e.g. action-method-validation.xml).
So, the options for how I use and configure input validations are somewhat limited, unless you can see an alternative that I'm missing (which could be possible, as I am a Struts2 neophyte).
I'd like to see some support for extending conversations across action classes. That extra bit of flexibility would make the ConversationInterceptor play a bit nicer with the rest of Struts2.