Search Results

Search found 2 results on 1 pages for 'beemaster'.

Page 1/1 | 1 

  • What is the meaning of @ModelAttribute annotation at method argument level?

    - by beemaster
    Spring 3 reference teaches us: When you place it on a method parameter, @ModelAttribute maps a model attribute to the specific, annotated method parameter I don't understand this magic spell, because i sure that model object's alias (key value if using ModelMap as return type) passed to the View after executing of the request handler method. Therefore when request handler method executes the model object's name can't be mapped to the method parameter. To solve this contradiction i went to stackoverflow and found this detailed example. The author of example said: // The "personAttribute" model has been passed to the controller from the JSP It seems, he is charmed by Spring reference... To dispel the charms i deployed his sample app in my environment and cruelly cut @ModelAttribute annotation from method MainController.saveEdit. As result the application works without any changes! So i conclude: the @ModelAttribute annotation is not needed to pass web form's field values to the argument's fields. Then i stuck to the question: what is the mean of @ModelAttribute annotation? If the only mean is to set alias for model object in View, then why this way better than explicitly adding of object to ModelMap?

    Read the article

  • What is the mean of @ModelAttribute annotation at method argument level?

    - by beemaster
    Spring 3 reference teaches us: When you place it on a method parameter, @ModelAttribute maps a model attribute to the specific, annotated method parameter I don't understand this magic spell, because i sure that model object's alias (key value if using ModelMap as return type) passed to the View after executing of the request handler method. Therefore when request handler method executes the model object's name can't be mapped to the method parameter. To solve this contradiction i went to stackoverflow and found this detailed example. The author of example said: // The "personAttribute" model has been passed to the controller from the JSP It seems, he is charmed by Spring reference... To dispel the charms i deployed his sample app in my environment and cruelly cut @ModelAttribute annotation from method MainController.saveEdit. As result the application works without any changes! So i conclude: the @ModelAttribute annotation is not needed to pass web form's field values to the argument's fields. Then i stuck to the question: what is the mean of @ModelAttribute annotation? If the only mean is to set alias for model object in View, then why this way better than explicitly adding of object to ModelMap?

    Read the article

1