开发者

jsf-2.0: Big pb using forEach beside get parameter

开发者 https://www.devze.com 2023-04-05 07:00 出处:网络
Here the code, hope you can help me. <f:metadata> <f:viewParam name=\"id\" value=\"#{edit.id}\" required=\"true\" requiredMessage=\"required\" />

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

精彩评论

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

关注公众号