Results 1 to 2 of 2

Thread: view-state id convention

  1. #1
    Join Date
    Mar 2005
    Posts
    144

    Default view-state id convention

    If I had the following view state:

    <view-state id="enterBookingDetails"/>

    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.

  2. #2
    Join Date
    Mar 2005
    Posts
    144

    Default Do I understand this correctly?

    Ah, there appears to be two parts to this convention. For the following view state:

    <view-state id="enterBookingDetails"/>

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •