Results 1 to 3 of 3

Thread: Custom Property Editor for form field with variable name?

  1. #1
    Join Date
    Oct 2004
    Location
    NYC, USA
    Posts
    13

    Default Custom Property Editor for form field with variable name?

    Hi all,

    I'm trying to register a custom property editor in my controller for a .jsp text input field with a name attribute that changes... and I'm having trouble writing the binder.registerCustomEditor() statement:



    These code samples should help explain:

    My .jsp:
    Code:
    	<c&#58;forEach var="buyerSeller" items="$&#123;BlockTrade.buyerSellers&#125;" varStatus="status">
     		Broker&#58; <input type="text" name="buyerSellers&#91;<c&#58;out value="$&#123;status.index&#125;"/>&#93;.broker" value="some value" /></br>
                    </p>
    	</c&#58;forEach>
    Essentially the field name changes based on the index and becomes
    buyerSellers[0].broker,
    buyerSellers[1].broker,
    buyerSellers[2].broker,
    etc.,
    etc.

    The only binder.registerCustomEditor() statement I have gotten to work is as following:

    Code:
    		binder.registerCustomEditor&#40;Broker.class, "buyerSellers&#91;0&#93;.broker", customBrokerEditor&#41;;
    		binder.registerCustomEditor&#40;Broker.class, "buyerSellers&#91;1&#93;.broker", customBrokerEditor&#41;;
    etc.
    etc.
    etc.
    Is there a way to register the custom property editor to the field in a single statement?

  2. #2
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,104

    Default

    If all Broker.class fields are handled the same way you can try:
    Code:
    binder.registerCustomEditor&#40;Broker.class, customBrokerEditor&#41;;

  3. #3
    Join Date
    Oct 2004
    Location
    NYC, USA
    Posts
    13

    Default

    that worked great, thanks

Similar Threads

  1. Order of Bean definitions matters?
    By cfuser in forum Container
    Replies: 2
    Last Post: Oct 21st, 2005, 10:29 AM
  2. Unit testing with JOTM and JtaTransactionManager
    By lalle in forum Architecture
    Replies: 1
    Last Post: Oct 15th, 2005, 09:05 AM
  3. EHCaching Hibernate
    By dencamel in forum Data
    Replies: 3
    Last Post: Sep 6th, 2005, 09:03 PM
  4. Replies: 4
    Last Post: Aug 17th, 2005, 04:42 AM
  5. Replies: 2
    Last Post: May 13th, 2005, 05:42 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
  •