conditionally rendered input component does not update value

后端 未结 2 1950
北荒
北荒 2021-01-13 23:21

Using jsf 2 and Primefaces 3.4

I am aware that there are many similar questions but none of them work on this one.

When the panelGrid \"inner\" is rendered w

相关标签:
2条回答
  • 2021-01-14 00:07

    Try jstl c:if tag in place of rendered. That works for me.

    0 讨论(0)
  • 2021-01-14 00:20

    Your rendered condition apparently depends on a request scoped variabe, e.g. a property of a request scoped managed bean or a request parameter. A form submit accounts as a completely independent and brand new request whrein all request scoped managed beans are newly recreated, with all properties set to default. If the rendered attribute evaluates to false during collecting the submitted values (the apply request values phase of the form submit), then they simply won't be collected.

    There are basically 2 ways to solve this:

    1. Make sure that the condition behind the rendered attribute is properly preinitialized in the (post)constructor of the request scoped bean so that it returns exactly the same value during the request of processing the form submit as it was during the request of displaying the form to the enduser.

    2. Put the bean in the view scope instead. This way the bean instance will live as long as you're interacting with the same view by ajax or by returning void or null in action method.

    See also:

    • commandButton/commandLink/ajax action/listener method not invoked or input value not updated (point 5 applies to you).
    • How to choose the right bean scope?
    0 讨论(0)
提交回复
热议问题