开发者

jsf-2.0: Big pb using forEach beside get parameter

Here the code, hope you can help me.

<f:metadata>
    <f:viewParam name="id" value="#{edit.id}" required="true" requiredMessage="required" />
    <f:event type="preRenderView" listener="#{edit.create}" />
</f:metadata>
.....
<c:forEach items="#{edit.elements}" var="element">
    <ui:include sr开发者_开发百科c="/include/#{element}.xhtml" />
</c:forEach>

I absolutely need to include dynamic page because huge number of it unknown in advance... So the problem is that method create is called after getting the list of elements due to c:forEach lifecycle.

I also tried preValidate, postValidate and preRenderComponent event but nothing helps.

Thanks a lot; you are my heroes


I found a workaround to make it work. Just add the followings:

<input type="hidden" name="id" value="#{edit.id}" />

@ManagedProperty(value = "#{param.id}")
private Integer id;

It seems to work in any case but not sure about the best practice..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜