Skip to content

Corrupt Data - data on second page of submit is corrupted when referenced via "path" attribute (but is fine when referenced using jstl) [SPR-10442] #15075

Closed
@spring-projects-issues

Description

@spring-projects-issues

Will Dev opened SPR-10442 and commented

See attached pictured called "Spring MVC Bug - Screenshot" for the fastest explanation.

When -

  1. A form's modelAttribute value is the same as the class name (or starts with the classname - softwareVendorVO2 had the same problem)
  2. Data is referenced through the path variable on a form item
  3. indexes are used
  4. A page is submitted
  5. On the new page - despite the data being sent to the page being completely new - it's displaying totally different data.

You can see from the screenshot - the actual data, being referenced by jstl and ${}, is correct. But the data displayed via the path="" attribute is completely wrong and different data. (In the controller, the data on the 2nd page is not from the first page - it's completely newly created data).

This is causing problems where:

  1. The checkboxes on the second page are blank - even though they should be checked
  2. I'm having issues where string labels are having the same problem - the second page has the values from the first page, even though it should have a completely new set of values
  3. Sometimes I'm seeing corruption in the string data - a value like "bob" is showing up on the second page as "bob,bob" or "bob,bob,bob", etc.

Note that the attached files only show problem #1 - I just didn't have time to reproduce test cases for #2 and #3.

But all problems go away when the modelAttribute name is changed to something that's not the same as the class name.

But it's VERY COMMON, as far as I know (as that's what everyone on our team did by default) to use the classname as the model name. This just shouldn't be happening, something is getting corrupted or something somewhere.


Affects: 3.2.2

Attachments:

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: webIssues in web modules (web, webmvc, webflux, websocket)status: bulk-closedAn outdated, unresolved issue that's closed in bulk as part of a cleaning process

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions