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

  • Question about Spring Binding

    Hi All,

    I just want to know that in a page having a form we have to do binding using tags like <spring:bind path="loginCommand"> and so on. Is it possible that the binding of form could be done automatticaly with the command object e.g. using the name of the control. For example a text field with name = "user" could be binded to loginCommand.user without the use <spring:bind> tag. This is exactly what is done by ActionForm in struts where ActionForm is populated from html form using naming convention. If it is possible please guide me how to do it?

  • #2
    shaby775,

    The spring binds your form data into the model automatically. Only thing is that the field names in the page and the model should match.

    --
    Kamal

    Comment


    • #3
      Hi,
      Thanks for reply but could u give me some example how to do it without using <spring:bind> tag or some documentation about it as i found nothing on it. Specifically what are the advantages/disadvantages of this approach. Thanks in advance.

      Comment


      • #4
        <input type="text" name="model.userName">

        where "model" in model.username is the CommandName.

        class Model {

        private String userName;

        getter & setter for the above member;

        }

        this should now bind automatically.

        --
        Kamal

        Comment

        Working...
        X