-
Notifications
You must be signed in to change notification settings - Fork 494
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
Recommended way to go after upgrade to SpringBoot3 - attributes #920
Comments
These objects are not directly available in templates in Thymeleaf 3.1 for security reasons. The recommended way to make this information available to templates is to add the specific pieces of information that are really needed by the template as context variables (model attributes in Spring). So in your case, the base case would be your controller code adding the servlet path to the model like e.g.: model.addAttribute("servletPath", request.getServletPath(); ...and then you would use the However, you mention that you would prefer not to add this in all your controllers. In such case, in order to avoid doing this in each of the controller methods of your controller class, you can add the parts of the request you need just once by making use of Spring's And if you need several pieces of data from your Hope this helps. |
Thanks for the explanation, I'll see how this integrates into my application but I loved the way it was before: very easy to integrate ;) |
After playing around with the latest SpringBoot 3.0-RC1 I realized my application is not working anymore due to:
Caused by: java.lang.IllegalArgumentException: The 'request','session','servletContext' and 'response' expression utility objects are no longer available by default for template expressions and their use is not recommended. In cases where they are really needed, they should be manually added as context variables.
Is there recommended way to integrate these attributes into the views?
Personally I wouldn't want to integrate all of these things manually in all my controller as I have request-specific highlighting in the navigation bar, which applies to all of my app components.
An example for that is:
I hope that this is the correct project to file this issue - thanks for any advice/hint in advance.
The text was updated successfully, but these errors were encountered: