Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6053571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:03:18+00:00 2026-05-23T08:03:18+00:00

I am trying to send custom javascript object (actually, its array of JSON objects)

  • 0

I am trying to send custom javascript object (actually, its array of JSON objects) via jquery post request to spring controller.
The server-side fails with “bla-bla no matching editors or conversion strategy found” error. It can’t convert from string to server-side object.
I found this and this examples but I can’t put it together to make it work.
Which methods of PropertyEditor should I override?
Does anybody knows link to any example?
Thank you.

Controller:

private class AddressFormEditor extends PropertyEditorSupport {
    protected Object convertElement(Object element)
    {
        String form = "";

        if (element instanceof String)
                form = (String) element;
        Logger logger = Logger.getLogger(getClass().getName());
        logger.warning(form);
        return form != null ? new AddressForm(form) : null;
    }
}

@InitBinder
protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception
{       
      binder.registerCustomEditor(AddressForm.class, new AddressFormEditor());
}  
@RequestMapping(value = "/save", method = RequestMethod.POST)
    public ModelAndView saveUser(@ModelAttribute UserForm form, HttpServletResponse response) {...}

UserForm:

public class UserForm extends BaseForm {
private Long id;
private String login;
private String password;
private String confirmPassword;
private String type;
private String franchise;
private String roles;
private String firstName;
private String lastName;
private String salutation;
private String position;
private String birthDate;
private String passportNumber;
private String passportIssueBy;
private String passportIssueDate;
private String passportExpireDate;
private String nationality;
private AddressForm[] addresses;
private String notes; ... }

jQuery request:

var data = $('#userForm').serializeObject();
        data.addresses = addresses;
        $.ajax({
            traditional: true,
            type: 'POST',
            url: url + 'save',
            data: data,
            success: function(response) {
                if (response) {
                    initializeUser(response);
                    hideWait();
                }
                else {
                    showUsers();
                    $('#closeUserBtn').click();
                }
            },
            error: function() {
                error();
                hideWait();
            }
        });

Logger writes that addresses is ‘[object Object]’ but actually the valid array was sent to server

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:03:19+00:00Added an answer on May 23, 2026 at 8:03 am

    Have a look at the editors under org.springframework.beans.propertyeditors (in the spring-beans jar), which contains the built-in editors provided with spring.

    Basically, you need to overwrite setAsText() and getAsText(), which allow you to read the object from a String and write the object as string respectively.

    CurrencyEditor could serve as a very simple example. CustomDateEditor could serve as a slightly more complex one. For an array example, have a look at the ClassArrayEditor, for example.


    However, The best way to go about this is to use a JSON mapping technology instead of parsing the JSON yourself; have a look at this post.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Actually I am trying to send data from jQuery to Spring controller and in
Im trying to send a custom HTML object from my ASP 2.0 website to
I am trying to send an anonymous object over a web service. Is there
I am trying to send an HTTP request with the contents of a file
I am trying to create a custom object in AS3 to pass information to
I'm trying to send objects from bundles over a dedicated communication bundle to an
I have an applet trying to send java serialized object to a servlet (hosted
I'm trying to send a custom intent to my service that is based off
I am trying to send custom data to initialize my jqgrid row selection. I
On Android, I am trying to send a custom broadcast message using a custom

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.