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

  • Home
  • SEARCH
  • 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 6591351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:24:46+00:00 2026-05-25T17:24:46+00:00

I have a form when submitted to a controller works fine, the controller signature

  • 0

I have a form when submitted to a controller works fine, the controller signature :

@RequestMapping(value = "/Save", method = RequestMethod.POST)
public ModelAndView save(@ModelAttribute MyDTO myDTO) {}

I have another controller method for handling an ajax request with this signature:

@RequestMapping(value = "/Preview", method = RequestMethod.POST)
public ModelAndView preview(@RequestBody MyDTO myDTO) {}

However submitting the serialized form returns this error : org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "myList[0]" (Class myPackage.dto.MyDTO), not marked as ignorable

The javascript/jquery is :

var json = jq("#dtoForm").serializeObject();
json = JSON.stringify(json);
jq.ajax({
        cache:false,
    type: 'POST',
    url: "${Preview}",
    data:json,
    contentType: "application/json",
    success:  function(data) {          
        previewDialog.html(data);
        previewDialog.dialog('open');
        }
});

What am I missing ? I am confused becuase the form submits fine (the dto is correctly mapped) when not converted json. The dto contains, amongst other things, a list.

Edit if I remove the json = JSON.stringify(json); as suggested by springsource I get a slightly different error (one of the fields in dto is called “title”):

org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Unrecognized token 'til': was expecting 'null', 'true' or 'false'
  • 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-25T17:24:47+00:00Added an answer on May 25, 2026 at 5:24 pm

    In case anyone else has same problem, I got the code from here : http://code.google.com/p/form2js/
    included the libs, and changed my code to this :

    var json = jq("#dtoForm").toObject(); //the new lib I dl'd from link
    json = JSON.stringify(json);
    ...
    //and then to do the same ajax call
    

    However, it is not completely solved as the spring-mvc form creates a hidden form element for each checkbox, which I then delete manually :

    delete json._MyBoolean;
    

    A side note, this all seems rather messy – shouldn’t spring/jackson be able to convert pojo’s to an html form and json in both directions with out all this extra stuff.

    (original stack ref to library is here)

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

Sidebar

Related Questions

I have this Controller : @Controller @RequestMapping(/path/*) public class MyController { @RequestMapping(value = /,
I have a JSP that submits via javascript to a controller. Everything works fine,
I have a form that when submitted successfully generates new elements on the page
I have a form, if submitted correctly, it hides the form. I added a
I have an Ajax form that updates a div when submitted with a submit
I have an ASP.NET MVC form that when submitted can return either an ActionResult
I have 4 forms on a page. Form 1 must be submitted with either
I have a spring controller defined like this: @Controller @RequestMapping(/user) class UserController { ...
Very strange issue... I have something like this in my Controller: public ActionResult Initialize(IEnumerable<MyModel>
I'm having an issue with my grails application. I have a form whose method

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.