ui:param ... and caching

I have the following thing:

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

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

Any ideas?

2 thoughts on “ui:param ... and caching”

  1. Опитваш се да го кешираш на грешното място. Направи си един метод или field, и го анотирай с @Produces @Named("randomVideo") и @RequestScoped (или @PageScoped, ако искаш да ползваш Seam Faces, или да си го напишеш сам), и после го ползвай като #{randomVideo}.

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.

This site uses Akismet to reduce spam. Learn how your comment data is processed.