Announcement Announcement Module
No announcement yet.
How to hold fields form than are not in the model object ? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to hold fields form than are not in the model object ?


    My model object is store in the session by the "formBackingObject" function.

    In my jsp page i use a selector with radio button, when i select one of them, it's send a submit, i make few operations to modify form informations (in the onSubmit function) and return to the form.

    But when i return to the form, the radio button is not checked of course because no one hold his value. So what is the best way to hold this type of value ?



  • #2
    The value should be returned in the request object, not the command object.


    • #3

      In fact i use the referenceData to map property not in my modele like this :

      in my jsp

      <select name="idAffrete" onchange="call('choixAffrete');">

      in my controller

      protected Map referenceData(HttpServletRequest request, Object command, Errors errors) throws Exception {
      String idAffrete=request.getParameter("idAffrete");


      refData.put("idAffrete", idAffrete);

      My jsp post the idAffrete to a request parameter, so i can use it in all the controller fonction (submit, onbindvalidate...) : classical.

      Before i return to the view, the fonction referenceData is called and i put the request value in the map with the same name. And my jsp use this value to display it and when i post ...

      It works fine for me, if anyone has another method, i will be happy to speak with him ;-),