Results 1 to 2 of 2

Thread: Webflow + MVC + Ajax = Suicidal Tendencies

  1. #1
    Join Date
    Apr 2011
    Location
    Waukesha, WI
    Posts
    9

    Default Webflow + MVC + Ajax = Suicidal Tendencies

    In an application we are working on has Webflow, Spring MVC and Ajax. Webflow manages the process, while Spring MVC manages the components along with Ajax. Hopefully this is not to confusing, if so here is the example. I'm sure someone else has done this before. If you need more detail, I'll try to be a specific as I can.

    Thanks for you help in advance.

    Building a Car

    My form is similar the following where the Parts objects are JPA objects.
    Code:
    public class CarForm implement Serializable {
         private List<Parts> passengerDoor;
    }
    The webflow is a work in progress flow, which allows a person to come back into the middle if not already submitted.
    Code:
    <flow ... parent="navigation-flow-states">
        <view-state id="passengerDoorState" view="passengerDoorView" model="carForm">
            <transition on="save" to="nextCarSection" validate="true">
                <evaluate expression="carFormController.processSection(passengerDoorView)"/>
            </transition>
        </view-state>
    </flow>
    The JSP page has a jQueryUI Accordian widget which allows for options on the parts to be modified. Parts are added by a modal dialog box that pops ups and has a part selection list in which the user can select a part. [NOTE: Kind of hard to show this type of functionality, hopefully my explanation helps.] The selected part is submitted via Ajax to a Spring MVC controller which adds the part to the passengerDoor part List on the CarForm.
    Code:
    @Controller("carFormController")
    public class CarFormController {
        private void PartsService partsService;
    
        public ModelAndView addPartsToPassengerDoor(HttpServletRequest request, ... partId) {
             CarForm carForm = FormAccessor.getCarForm(request);
             Part part = partsService.getPart(partId);
             carForm.getPassengerDoor().add(part);
    
             // ... add part to model and return to jsp ....
             return new ModelAndView("partComponent.jsp", "part", part) ;
        }
    }
    The html which is returned to jQuery which creates a new jQueryUI Accordian section. Expand the section and modify the attributes of the part.

    The inputs correspond to the position of the new element in the list such as name="passengerDoor[0].color".

    Then press save and I get the following error.


    Caused by: org.springframework.expression.spel.SpelEvaluation Exception: EL1025E: (pos 5): The collection has '2' elements, index '2' is invalid
    at org.springframework.expression.spel.ast.Indexer.ge tValueInternal(Indexer.java:122)
    at org.springframework.expression.spel.ast.CompoundEx pression.getValueInternal(CompoundExpression.java: 57)
    at org.springframework.expression.spel.standard.SpelE xpression.getValueType(SpelExpression.java:114)
    at org.springframework.binding.expression.spel.Spring ELExpression.getValueType(SpringELExpression.java: 95)
    ... 55 more

    I have even tried to use the supported auto growing list [http://forum.springsource.org/showth...ing-supported] but with little success.

  2. #2
    Join Date
    Apr 2011
    Location
    Waukesha, WI
    Posts
    9

    Default

    After more searching, I have found that this bug has been open since 2008.

    Here is the original issue: http://forum.springsource.org/showth...-dynamic-sizes

    Here is the JIRA issue: https://jira.springsource.org/browse/SWF-990

    I guess there is nothing to do about this until its fixed in spring webflow 3, which who knows if that fix gets back ported to prior versions.

Tags for this Thread

Posting Permissions

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