JSF ui:include not being rendered properly

前端 未结 1 1665
-上瘾入骨i
-上瘾入骨i 2020-12-17 07:09

I\'m implementing a web application using JSF 2.1.8 and I have a problem with the ui:include tag. I have this code



        
相关标签:
1条回答
  • 2020-12-17 07:45

    As to the cause of the problem, the <ui:include> runs during view build time (restore view phase) not during view render time (render response phase) as you seem to expect. So if the include path changes during for example invoke action phase or even render response phase, then it won't be reflected in the view unless it's completely rebuilt.

    Currently, your best bet is to use multiple static <ui:include> tags which are each conditionally rendered during view render time. True, this ends up with an unnecessarily large component tree. There is still no "holy grail" solution for this problem. The problem is clearly understood, but the solution is hard given the JSF/Facelets lifecycle. I have for OmniFaces done some experiments on that as well, however the simplest attempt fails hard in MyFaces while it works (to certain degree) in Mojarra.

    See also:

    • How to ajax-refresh dynamic include content by navigation menu? (JSF SPA)
    • Dynamic ajax navigation with <ui:include>
    0 讨论(0)
提交回复
热议问题