#{randomVi...">

<ui: param and caching

I have the following:

<ui:param name="randomVideo" value="#{bean.randomVideo}" /> <a href="#{randomVideo.link}">#{randomVideo.text}</a&></pre> 

Since <ui:param> does not Bean.getRandomVideo() variable, Bean.getRandomVideo() is called twice, and the worst part is that .text and .link are taken from different videos. I already tried <c:set and <f:param . They both do not set a variable, maybe because I'm with facelets (JSF2).

Any ideas?

+6
source share
1 answer

Getters are supposed to be real getters that don't contain any logic. So:

  • make your bean @RequestScoped
  • initialize randomVideo field in @PostConstruct
  • let the recipient receive only the randomVideo bean field.
+2
source

Source: https://habr.com/ru/post/893239/


All Articles