Announcement Announcement Module
Collapse
No announcement yet.
referenceData Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • referenceData

    this method returns a Map, right? so where can I attach this map with a ModelAndView? I mean, in which method?

  • #2
    If you want the reference data available for the initial display of the form, you don't need to do anything: Spring will add all the items in the map to the model.

    If you also want it available after a submit, you can add it to the model in onSubmit(), e.g.
    Code:
    Map m = errors.getModel();
    m.outAll(referenceData(request);
    HTH

    Comment


    • #3
      thanks man =)))) thank u very much

      Comment


      • #4
        oops, that of course should be
        m.putAll(referenceData(request));

        Glad to help,

        Comment


        • #5
          cmgharris,
          have u seen my another topic ?

          http://forum.springframework.org/vie...d9796a47ec11ed

          there, Could I use the formBackinObject to prepare the data of the employee and the referenceData to prepare the jobs and send the two of them to the frontend??

          Comment


          • #6
            See my reply in that topic.

            Comment


            • #7
              who calls referenceData? showForm() and showPage()?

              Comment


              • #8
                who calls referenceData?
                See my answer above

                showForm() and showPage()?
                I've not used these myself. The javadoc for showForm says
                Can be called within onSubmit implementations, to redirect back to the form in case of custom validation errors (i.e. not determined by the validator).
                As for showPage, I've never used the WizardFormController. Maybe someone else can help.

                Comment


                • #9
                  Hi guys!

                  I need your help here too! I'm using the referenceData(request) method to load a list of items based on a request parameter.
                  Code:
                      protected Map referenceData(HttpServletRequest request)
                          throws ServletException {
                      	String cdConta = request.getParameter("cdConta");
                          Map model = new HashMap();
                          if (log.isDebugEnabled()) {
                              log.debug("entering 'referenceData' method... \nContaID com getParameter: "+cdConta);
                          }		
                          model.put("contaReceberParcelaList", contaReceberParcelaManager.getContaReceberParcelas(Integer.valueOf(cdConta)));
                          return model;
                      }
                  All goes well with both POST and GET requests, until I have a bind error (e.g. data field is null). As you know if we have bind error the formView is shown again with the errors. But for some reason my request parameter is getting null and as a consequence I will have exception:
                  Code:
                  java.lang.NumberFormatException: null
                          at java.lang.Integer.parseInt(Integer.java:436)
                          at java.lang.Integer.valueOf(Integer.java:574)
                  when parsing the parameter (Integer.valueOf(cdConta));
                  Can anyone explain me this behavior?
                  Thanks for any help!
                  Gilberto

                  Comment


                  • #10
                    Hi, when u call log
                    log.debug("entering 'referenceData' method... \nContaID com getParameter: "+cdConta);

                    cdConta has a value?

                    I think cdConta has no value... so
                    in the line: String cdConta = request.getParameter("cdConta");
                    the request could has not this parameter

                    Comment


                    • #11
                      As I said on the last post, all is working except when occur an exception.
                      I want to know if this is right behavior?

                      Thanks!

                      Gilberto

                      Comment

                      Working...
                      X