Results 1 to 6 of 6

Thread: Web Form

  1. #1
    Join Date
    Jun 2007
    Posts
    14

    Default Web Form

    not an issue
    Last edited by mayank76; Nov 20th, 2007 at 05:14 PM. Reason: Not an Issue

  2. #2
    Join Date
    Nov 2005
    Location
    Reutlingen, Germany
    Posts
    2,098

    Default

    I do not really understand your questions. The idea of PropertyEditors is to convert a value to string and back. If your record fields are only of default types you don't need to do anything with them. It might be different for the drop-down since you might need to convert a record to a string directly, not only one of its fields. In this case you can use a PropertyEditor.

    Joerg
    This post can contain insufficient information.

  3. #3
    Join Date
    Aug 2007
    Posts
    3

    Default

    Mayank,

    Can you please explain in detail. You can mention them in points perhaps and we can eventually understand your concept.

  4. #4
    Join Date
    Nov 2005
    Location
    Reutlingen, Germany
    Posts
    2,098

    Default

    Quote Originally Posted by mayank76 View Post
    Ok let’s say I have a record with following layout and appears multiple times on the page (like a table structure). How should I design my form..?
    This is a very common use case. You have a form-backing object which holds a list of your records. In the JSP (or template language of your choice) you iterate over the list and create the rows in the table.

    Quote Originally Posted by mayank76 View Post
    Also, let say I want to display a list of countries in column2 (country object) and I have a customcountryEditor to convert from object to string. Now if I have 2 records on the page, can I use same countryEditor to bind column2 of record 1 and record2.
    Of course. You register your CustomCountryEditor for type Country.class or something like this and it works.

    Joerg
    This post can contain insufficient information.

  5. #5
    Join Date
    Aug 2007
    Posts
    3

    Default

    Quote Originally Posted by Jörg Heinicke View Post
    This is a very common use case. You have a form-backing object which holds a list of your records. In the JSP (or template language of your choice) you iterate over the list and create the rows in the table.



    Of course. You register your CustomCountryEditor for type Country.class or something like this and it works.

    Joerg
    I agree, thats pretty fine. I dont have much knowledge but you can try the Country.class, thats a nice solution.

  6. #6
    Join Date
    Nov 2005
    Location
    Reutlingen, Germany
    Posts
    2,098

    Default

    Quote Originally Posted by mayank76 View Post
    Thanks..I got it to work.
    I wonder if you really custom editor. What's actually the command object? commandForm or command? I'm confused by your code. Also consider using more advanced Spring's form taglib. This would reduce your code to 1 line.

    Quote Originally Posted by mayank76 View Post
    Once I display my form page for edit, user can add another row ( let say through javascript). How can I dynamically modify my command object on form submission. Can I use interceptor before controller to map and populate this additional row in command object..?
    Interceptor might work. The easiest solution is probably to use a lazy-initialized collection though.

    Joerg
    This post can contain insufficient information.

Posting Permissions

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