How can I reset JSF UIInput components to their managed bean values

前端 未结 1 1347
孤城傲影
孤城傲影 2021-01-25 00:34

I want to reset JSF inputs to their original managed bean values after validation failed.

I have two forms inside the same page - the first form has a commandLink<

相关标签:
1条回答
  • 2021-01-25 00:56

    In fact, there may turn out to be no better way than explicitly calling resetValue on components. In my case, all of the dialogs are in the same big JSF view tree with the underlying page that opens them. So from JSF's perspective, the same view component state including invalid input values should be preserved until we navigate away from the view, as it has no visibility into how we're toggling display attributes client-side.

    The only other thing that might work is if the components that make up the dialog are actually not rendered in the JSF view tree unless they're visible. In my case, they're always rendered, using CSS to toggle visibility.

    0 讨论(0)
提交回复
热议问题