简体   繁体   English

具有render属性的jsf组件验证失败

[英]jsf component with render attribute failing validation

I have couple of panel grids with rendered attribute, on value change event of a drop down list, I make one of the panel grids visible, this works fine. 我有几个具有渲染属性的面板网格,在下拉列表的值更改事件上,我使其中一个面板网格可见,这很好用。 But after the panel is displayed all the conversions and validations attached to components inside panel grid fail. 但是在显示面板之后,附加到面板网格内组件的所有转换和验证都将失败。

Even if the component is single and outside the grid it fails validation. 即使组件是单个的并且在网格外部,它也无法通过验证。

Am I missing something on rendered attribute? 我在渲染属性上缺少什么吗? Is there some thing going on in JSF lifecycle. JSF生命周期中是否正在发生某些事情。

Any help will be really helpful... 任何帮助都会非常有帮助...

Thanks in advance 提前致谢

I am using jsf 2.0 mojarra implentation. 我正在使用jsf 2.0 mojarra实现。

You need to ensure that the condition responsible for the rendered attribute evaluates the same in the subsequent request. 您需要确保负责rendered属性的条件在后续请求中的评估结果相同 JSF will namely recheck the condition during apply request values and validations phases. JSF将在申请请求值和验证阶段重新检查条件。 As of now it look like that your bean is request scoped and that the condition got lost in the subsequent request. 到目前为止,看起来您的bean已在request范围内,并且条件在后续请求中丢失了。 Easiest fix is to place the bean in view scope by annotating it as @ViewScoped . 最简单的解决方法是将bean注释为@ViewScoped ,将其放置在view范围内。 This way the bean will live as long as you're interacting with the same view. 这样,只要您与同一个视图进行交互,bean就会一直存在。

See also: 也可以看看:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM