Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring modelattribute not recognized after ajax update anymore [SPR-15788] #20343

spring-issuemaster opened this issue Jul 18, 2017 · 3 comments


Copy link

@spring-issuemaster spring-issuemaster commented Jul 18, 2017

Thomas Lang opened SPR-15788 and commented

Short summary of the problem. Please see the detailed in the attached stackoverflow link:

  1. I use a pojo dto to bind a thymeleaf view to it.
  2. This pojo has a list of T instances, called items
  3. I bind this dto pojo to the view in my controller:
model.addAttribute("invoiceDto", new InvoiceDto(setting.get(), applicationUserContactProjection.get()));
  1. I can access the list in the pojo via thymeleaf
<input type="text" th:field="*{items[__${index.index}__].lineItemTotalPrice}" readonly      class="form-control" disabled id="lineItemTotalPrice"/>
  1. the path is items
  2. i can add items via ajax in a controller method (i post the whole invoiceDto Model to the controller)
invoiceDto.addItem(new LineItem());
  1. i return a thymeleaf partial view from this controller´s method
  2. when spring renders the partial view the access to the path fails
<input type="text" th:field="*{items[__${index.index}__].lineItemTotalPrice}" readonly
                           class="form-control" disabled id="lineItemTotalPrice"/>
  1. i have to use a separate partial view
<input type="text" th:field="*{invoiceDto.items[__${index.index}__].lineItemTotalPrice}" readonly class="form-control" disabled id="lineItemTotalPrice"/>
  1. in this special view i have to prepend "invoiceDto" to get the path right

I hope my problem has been clearly described? This is not a critical issue. It´s just annoying, because i have to use different views.

See the files attached.
Thank you for your help.

Affects: 4.3.7

Reference URL:


Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Nov 28, 2017

Thomas Lang commented

Hey there,
i just wanted to know if there is any progress on this issue?
It was filed some months ago.
This is not a show stopper, but nevertheless very annoying.
It would be cool if somebody could give some feedback what will be done about that issue at least.

If you need some further information please don´t mind to contact me.

Thank you!
Kind regards!

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Apr 6, 2018

Brian Clozel commented

Sorry for the late reply.
I'm closing this issue as this is actually a Thymeleaf question.
You can find similar questions on StackOverflow like this one or that one.

I guess reducing significantly the scope of your question and the noise around it, making it a minimal, complete, verifiable example would get more attention from the SO community.

In the future, please use this issue tracker for bugs and enhancement requests only - you'll get better results from well crafted questions on StackOverflow.


Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Apr 7, 2018

Thomas Lang commented

Hey there Brian,

thanks for your reply.
I have asked the question in the first place on stack overflow already.
See the reference link above.
But i got no answers on that.
So i decided on the second step to file an issue at spring.

Please note that this issue happens even with jsp, not only thymeleaf.
I think that this is not an view engine issue.

But as i see on the stack overflow response to my question, nobody else is obviously struggling with this behaviour.
My workaround is to use two views.
So i can live with that.

Anyway - maybe someone stumbles over this issue again somtimes.
If you want to follow this i can tailor you a github project where you can see the issue in action.

Nevertheless - thank you for your help.
By the way: I love working with spring. Good job!

Kind regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.