I am having issues setting nested parameters on an object using the
json-plugin.  I've created a basic example that I'm currently testing.
When debugging at the "return SUCCESS" line, both the testValue and
contactId variables are set correctly.  The contact variable, however, is
null.  The relevant console lines line is "WARN : Parameter
[contact[firstName]] didn't match acceptedPattern pattern!" - but I'm not
sure how to fix that as it *should* match the setContact() setter in my
Action.  Any thoughts on what is going on here?  Thanks in advance....

-- ACTION --
public class ContactJsonAction {

    private Integer contactId;
    private Contact contact;
    private String testValue;

    public String contactUpdate() throws Exception {
            return SUCCESS;
    }

   // Getters & Setters below....
}

-- JSON TEST SUBMISSION --
$.ajax({
  ... other ajax settings ...
 // manually insert data for testing
 data    : {"testValue":"yes","contact":{"firstName":"John"
},"contactId":100},
});

-- LOGS --
DEBUG: Creating an DefaultActionProxy for namespace [/app/json] and action
name [ContactDetail_update]
Oct 28, 17:15:34 (CommonsLogger.java:72)
DEBUG: cannot find method [prepareContactUpdate] in action
[com.afs.web.action.json.ContactJsonAction@b7a6ee]
Oct 28, 17:15:34 (CommonsLogger.java:72)
DEBUG: cannot find method [prepareDoContactUpdate] in action
[com.afs.web.action.json.ContactJsonAction@b7a6ee]
Oct 28, 17:15:34 (CommonsLogger.java:72)
DEBUG: Setting params NONE
Oct 28, 17:15:34 (CommonsLogger.java:72)
DEBUG: Setting params testValue => [ yes ] contact[firstName] => [ Bean ]
contactId => [ 100 ]
Oct 28, 17:15:34 (CommonsLogger.java:72)
DEBUG: Parameter [contactId] was accepted and will be appended to action!
Oct 28, 17:15:34 (CommonsLogger.java:56)
WARN : Parameter [contact[firstName]] didn't match acceptedPattern pattern!
Oct 28, 17:15:34 (CommonsLogger.java:72)
DEBUG: Parameter [testValue] was accepted and will be appended to action!
Oct 28, 17:15:34 (CommonsLogger.java:76)
DEBUG: Retrieving convert for class [class
com.afs.web.action.json.ContactJsonAction] and property [contactId]
Oct 28, 17:15:34 (CommonsLogger.java:72)
DEBUG: field-level type converter for property [contactId] = none found
Oct 28, 17:15:34 (CommonsLogger.java:72)
DEBUG: global-level type converter for property [contactId] =
com.afs.web.converter.MyNumberConverter@1611a05
Oct 28, 17:15:34 (CommonsLogger.java:76)
DEBUG: Retrieving convert for class [class
com.afs.web.action.json.ContactJsonAction] and property [testValue]
Oct 28, 17:15:34 (CommonsLogger.java:72)
DEBUG: field-level type converter for property [testValue] = none found
Oct 28, 17:15:34 (CommonsLogger.java:72)
DEBUG: global-level type converter for property [testValue] = none found
Oct 28, 17:15:34 (CommonsLogger.java:72)
DEBUG: falling back to default type converter
[com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter@a5eac1]
Oct 28, 17:15:34 (CommonsLogger.java:72)

Reply via email to