@ManagedProperty does not reflect changes and keeps returning null

后端 未结 5 1977
花落未央
花落未央 2021-01-14 11:07

I\'m trying to inject the value of one sessionscoped bean into a viewscoped bean but it keeps returning null, here\'s a snippet:

import javax.faces.applicati         


        
5条回答
  •  悲&欢浪女
    2021-01-14 11:30

    #{user.userName} is interpreted by JSF as getUser().getUserName()

    So it is better to have a @ManagedProperty of type User, with its getter/setter methods getUser/setUser. With that you can access the user's name by #{user.userName}.

提交回复
热议问题