Results 1 to 4 of 4

Thread: Question about Spring Binding

  1. #1
    Join Date
    Aug 2004
    Posts
    105

    Default 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?
    Regards,
    Shoaib Akhtar

  2. #2
    Join Date
    Feb 2005
    Posts
    25

    Default

    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

  3. #3
    Join Date
    Aug 2004
    Posts
    105

    Default

    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.
    Regards,
    Shoaib Akhtar

  4. #4
    Join Date
    Feb 2005
    Posts
    25

    Default

    <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

Similar Threads

  1. Replies: 3
    Last Post: Sep 29th, 2005, 03:30 PM
  2. Newbie Question - The Ideal Spring Solution
    By conorp in forum Architecture
    Replies: 3
    Last Post: Aug 23rd, 2005, 03:22 AM
  3. Spring debugging question : IoC
    By etienno in forum Architecture
    Replies: 7
    Last Post: Apr 13th, 2005, 08:26 AM
  4. Replies: 14
    Last Post: Feb 21st, 2005, 05:41 PM
  5. Replies: 2
    Last Post: Aug 17th, 2004, 04:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •