@WindowParam or userSession.setAttribute best practice

Happy new year to all. I have a very simple question, within the best practices it’s better to use @WindowParam for the injection of data to use in the views or make direct use of userSession.setAttribute and userSession.getAttribute?


Nelson F

Hi, Nelson!

In general, if you just want to pass some data to a screen it’s recommended to use @WindowParam annotation. Check the documentation (last paragraph): link.

UserSession#setAttribute() is more for setting some session-specific params.