Results 1 to 2 of 2

Thread: I am confused by how to bind to complex objects

  1. #1
    Join Date
    Dec 2004
    Posts
    19

    Default I am confused by how to bind to complex objects

    I am confused by how to bind to complex objects!!

    Take for example, I have a form for editing private messages in between users.

    So, lets assume

    id Long
    User from
    User to
    String subject
    String message

    How exactly would I go about dealing with the user objects? ie. I want a User submitting to be able to enter in a string representation of the Username. If they submit, and the user doesn't exist in the database, I'd obviously like to let them know the user doesn't exist and repost the error with all the form data entered. I've read through the forum and read something about PropertyEditors, but there doesn't seem to be a real guide anywhere to go about doing this.

    I would imagine, I need to grab the username, call a lowerlevel method checking if the username exists in the database,but I'm at a loss for what to put in my jsps and where to put this logic in the FormController.

    Any help would be greatly appretiated.

    ..jordan willms

  2. #2
    Join Date
    Dec 2004
    Posts
    19

    Default Re: I am confused by how to bind to complex objects

    allright. So I've created a UserEditor object, and also a group object (because in my system a private message can also be directed to a group).

    A new problem has unfolded.

    Basically, I need to make some of the fields optional to bind to. Ie. there is a group field, and a user field (for username or groupname). Only one of either should be filled in.

    Currently, both need to be filled in to get even have the ability to save (because I get init binding errors since one is empty).

    The solution I really want, is a single text form field, where a visitor can either enter a username OR a groupname, and the Form figures out which (if any) match the database, and submits it if it does, or presents nice error messages ("Could not find a matching User or Group")

    Any advice? I'm a little lost here!

    Jordan.

Similar Threads

  1. HttpInvoker with complex objects as parameters fails
    By iloveopensource in forum Remoting
    Replies: 5
    Last Post: Feb 5th, 2006, 12:10 PM
  2. Replies: 2
    Last Post: Oct 10th, 2005, 05:12 PM
  3. Replies: 8
    Last Post: Jul 29th, 2005, 06:40 PM
  4. Replies: 12
    Last Post: Jun 21st, 2005, 01:28 PM
  5. Replies: 0
    Last Post: Jan 6th, 2005, 08:19 AM

Posting Permissions

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