-
Notifications
You must be signed in to change notification settings - Fork 69
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 MVC model not forwarded #378
Comments
it seems that can be solved by adding
in the
|
@blaluc thanks for sharing. Your suggested fix looks good to me. However I'm not a heavy spring user and don't know if this has any unintended side effects. @atomfrede, @tschuehly would this change be okay with you? |
At first glance it looks okay. Found similar issues with pebble for example. Not sure why it works for thymeleaf out of the box because it looks like the |
I have found why it works with thymeleaf. In case it is forwarded, thymeleaf creates an |
@blaluc Just curious, whats the use case for the forward (instead e.g. redirect with flash attributes for example), besides being the forward totally server side? |
Hi @atomfrede, the use case I’m working on involves integrating with the htmx library (https://htmx.org/). To handle a full-page reload, it might be useful to forward the model built in a 'partial' controller method (server-side) to another controller method responsible for rendering the full page. |
@blaluc did you check if it has any impact on normal view resolving? And, would you be up to submit a Pull Request with your suggested fix? |
Done (#383). To avoid any impact I have added a configuration parameter (the default behavior is the previous one). Cheers! |
* Spring MVC model not forwarded #378 * Update jte-spring-boot-starter-3/src/main/resources/META-INF/spring-configuration-metadata.json Co-authored-by: Frederik Hahne <[email protected]> --------- Co-authored-by: blasetti <[email protected]> Co-authored-by: Andreas Hager <[email protected]> Co-authored-by: Frederik Hahne <[email protected]>
This is now released with jte 3.1.13 |
It seems that while forwarding requests, the model instance is not injected from the request scope.
e.g.:
index.jte:
By calling http://localhost:8080/second, the
key2
value should be propagated to the template and displayed, but it is not, and the following page is shown instead:The same example with thymeleaf works as expected giving the result:
The text was updated successfully, but these errors were encountered: