Mar 5th, 2011, 03:48 PM
view-state id convention
If I had the following view state:
By convention, SWF maps the "enterBookingDetails" to a enterBookingDetails.jsp file in the same directory as the flow definition file.
If however, I have the following view state:
<view-state id="enterBookingDetails" view="enterSomethingElse"/>
Instead of using the same convention to map the logical view name "enterSomethingElse" to a enterSomethingElse.jsp file in the same directory, I receive an exception indicating enterSomethingElse is an Unsupported view type. If I add a .jsp extension to it, everything works fine.
Is this the desired behavior? I would have thought that they would work the same.
Mar 5th, 2011, 04:20 PM
Do I understand this correctly?
Ah, there appears to be two parts to this convention. For the following view state:
Because there is no "view" attribute defined, the following method gets called on the FlowViewResolver:
public String getViewIdByConvention(String viewStateId)
In the default implementation (FlowResourceFlowViewResolver), the view is determined to be the id attribute plus the defaultViewSuffix, which happens to be ".jsp".
This logic is never called if a view is specified, there for, this naming convention is not applied to the view as well.
If you choose to integrate with an existing Spring MVC view resolver, then the logical view name will be converted just like it is for Spring MVC.