Setting ui:param conditionally

前端 未结 2 1657
遥遥无期
遥遥无期 2021-01-12 01:04

I want to set a ui:param depending on a bean value and I thought using c:if was a good idea. So I put in my page the following code:



        
2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-12 01:34

    You are using JSTL with Facelets. JSTL are executed during view build time, and not in render phase. Additionally there some issues with processing them in JSF2 libraries - like in older Mojarra versions, where they didn't work on view scoped beans with partial state saving - see https://stackoverflow.com/a/3343681). This is why your EL expression has worked.

    The solution is to avoid JSTL - use ui:repeat instead c:forEach and EL expression and conditional rendering instead of c:if.

提交回复
热议问题