Is there a way using Java to not pass Messages and RequestHeader to every page that has a form or messages inside ? #11889
Replies: 3 comments 2 replies
-
You should be able to inject components you need into your views with |
Beta Was this translation helpful? Give feedback.
-
I also am trying to upgrade and update messages. This documentation has me adding the request as a parameter: But then my routes have to have it:
And then I get this:
I'm not sure what that means. And it seems like it shouldn't be necessary to pass in the request from the routes like this. Any help?
|
Beta Was this translation helpful? Give feedback.
-
It's so unfortunate that Play removed the context and royally screwed up Java users. I can completely understand why they did it for Scala users (with implicits), but as it says on the migration page :- "play.mvc.Http.Context is a crucial part of Java HTTP & MVC APIs, but it is not a good abstraction of how these APIs should work." Yes indeed, it is a crucial part of java http and MVC apis. And you lead with that, and then just remove it. When I first started my startup I spoke (face to face) with two of the Play developers about how second class their Java support seemed. That was bumped up the chain to Lightbend. But this just goes to show the same thing.. I'm going to have to stick with 2.6, and pray that Java gets implicits one day. Until then, I don't want to pollute my whole stack with Request arguments just to be able to access the (heavily customised and heavily used) context which we heavily rely on :( It seems to me (from research) that you've dramatically lost lots of java users because of this change.. |
Beta Was this translation helpful? Give feedback.
-
I'm working to update our current version of play framework actually using 2.7 with a ton of deprecated warning and want to update to 2.8.
The modifications I realize I have to make is to have request as a parameter in all methods and routes, and for views call with messages ( all pages use messages ) and a RequestHeader parameters for every page that uses a Form.
Is this the right way to do it?
Is there another way to no have to pass these three things apart from all out extra parameters ?
Beta Was this translation helpful? Give feedback.
All reactions