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 6668425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:02:26+00:00 2026-05-26T03:02:26+00:00

I am trying to send object’s array to Spring controller via jQuery AJAX. Here

  • 0

I am trying to send object’s array to Spring controller via jQuery AJAX.
Here is the javascript code:

var data = new Array();
            $.each(products, function (i) {
                var temp = {};
                temp.orpid = products[i].orpid;
                temp.orpah = $('#orpah' + products[i].orpid).is(':checked');
                temp.orpad = $('#orpad' + products[i].orpid).val();
                data.push(temp);
            });
            $.postJSON(url + 'save',
                    data,
                    function(response) {
                        if (response.isAuthenticated && response.isAuthorized) {
                            if (response.hasErrors) {
                                $('#routeForm').setErrors(response.errors);
                                hideWait();
                            }
                        }
                        else
                            redirectToLogin();
                    });

Here are the params that are sent to the server:

[{"orpid":10,"orpah":false,"orpad":""},{"orpid":11,"orpah":false,"orpad":""}]

The controller’s method has following definition:

@RequestMapping(value = "/save", method = RequestMethod.POST, headers = BaseController.AJAX_HEADER)
public ModelAndView save(@RequestBody HandlingOrderProductActionForm form, HttpServletResponse response) {...}

where HandlingOrderProductActionForm is:

public class HandlingOrderProductActionForm extends BaseForm {  
public class ActionForm {
    private Boolean orpah;
    private String orpad;
    private Long orpid;

    public ActionForm() { }

    public void setOrpah(Boolean orpah) {
        this.orpah = orpah;
    }

    public Boolean getOrpah() {
        return orpah;
    }

    public void setOrpad(String orpad) {
        this.orpad = orpad;
    }

    public String getOrpad() {
        return orpad;
    }

    public void setOrpid(Long orpid) {
        this.orpid = orpid;
    }

    public Long getOrpid() {
        return orpid;
    }
}

private List<ActionForm> actions;

/**
 * 
 */
public HandlingOrderProductActionForm() {
    super();
}

public void setActions(List<ActionForm> actions) {
    this.actions = actions;
}

public List<ActionForm> getActions() {
    return actions;
} }

The problem is, that the server returns an 415 error:

The server refused this request because the request entity is in a format not supported by the requested resource for the requested method ().

Any ideas?
Thank you

  • 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-26T03:02:26+00:00Added an answer on May 26, 2026 at 3:02 am

    THe problem is solved – just move the ActionForm to separate class!

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

Sidebar

Related Questions

i'm trying to send an js object to a php function using jquery.ajax .
I have a c# object (below) that I'm trying to send to my javascript.
I am trying to send data over to a cakephp (mvc) website, via $.post().
I am trying to send a form to a PHP file via jQuery. The
I'm trying to send an array of objects wrapped in an array object wrapper
I'm trying to figure out how to send a complex object through javascript to
Happy coding weekend to everyone!!!. I'm stuck trying to send a JSON object via
I'm trying to send data to a web service using jQuery's post() command -
I am trying to send an anonymous object over a web service. Is there
I am trying to send a file via Bluetooth using the GameKit framework. The

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.