How to make a Model attribute global?

前端 未结 2 378
轮回少年
轮回少年 2021-01-04 06:32

I\'m using Spring MVC Framework and I\'d like all the .jsp pages of the View to have access to the User\'s attributes(name, sex, age...). So far, I

2条回答
  •  时光取名叫无心
    2021-01-04 06:57

    If it is about User's attributes, you can bind the model bean to session as an attribute which can be accessed on every view. This needs to be done only once.

    Another option could be is to implement a HandlerInterceptor, and expose the model to every request.

提交回复
热议问题