/**
   * Handles the return from a multi-value lookup, processing any select line values and invoking
   * the configured view helper service to create the lines for those values in the model
   * collection.
   *
   * <p>There are two supported strategies for returning the selected lines. One, if the lookup view
   * and the caller are within the same application container, Springs input flash map is used. If
   * however, the lookup view is outside the caller, then just a standard request parameter is used.
   *
   * @param form form instance containing the model data
   * @param request http request object being handled
   */
  protected void processMultiValueReturn(final UifFormBase form, HttpServletRequest request) {
    final String lookupCollectionId = request.getParameter(UifParameters.LOOKUP_COLLECTION_ID);

    final String lookupCollectionName = request.getParameter(UifParameters.LOOKUP_COLLECTION_NAME);
    if (StringUtils.isBlank(lookupCollectionName)) {
      throw new RuntimeException(
          "Lookup collection name is required for processing multi-value lookup results");
    }

    final String multiValueReturnFields =
        request.getParameter(UifParameters.MULIT_VALUE_RETURN_FILEDS);
    String selectedLineValuesParam = request.getParameter(UifParameters.SELECTED_LINE_VALUES);

    String flashMapSelectedLineValues = "";
    if (RequestContextUtils.getInputFlashMap(request) != null) {
      flashMapSelectedLineValues =
          (String)
              RequestContextUtils.getInputFlashMap(request).get(UifParameters.SELECTED_LINE_VALUES);
    }

    if (!StringUtils.isBlank(flashMapSelectedLineValues)) {
      selectedLineValuesParam = flashMapSelectedLineValues;
    }

    final String selectedLineValues = selectedLineValuesParam;

    Runnable runnable =
        new Runnable() {
          @Override
          public void run() {
            // invoked view helper to populate the collection from lookup results
            ViewLifecycle.getHelper()
                .processMultipleValueLookupResults(
                    form,
                    lookupCollectionId,
                    lookupCollectionName,
                    multiValueReturnFields,
                    selectedLineValues);
          }
        };

    ViewLifecycle.encapsulateLifecycle(
        form.getView(), form, form.getViewPostMetadata(), null, request, runnable);
  }
  @RequestMapping(value = "/mainpage", method = RequestMethod.GET)
  public String goMainPage(HttpServletRequest request) {

    Map<String, ?> map = RequestContextUtils.getInputFlashMap(request);
    if (map != null) {
      logger.info("redirect!");
    } else {
      logger.info("update!");
    }

    return "main";
  }