Why my jsf dont set the value in bean class?

前端 未结 2 614
梦谈多话
梦谈多话 2020-12-20 09:43

I have a problem about of JSF, I\'m trying to set value of a variable in a bean class but it can\'t set value by t

相关标签:
2条回答
  • 2020-12-20 10:03

    Your problem is caused by having immediate="true" on the <h:commandButton>.

    <h:commandButton ... action="#{bean.action}" immediate="true" />
    

    It will skip processing of all input fields which doesn't have immediate="true".

    Just get rid of it.

    <h:commandButton ... action="#{bean.action}" />
    

    See also:

    • Trying to understand immediate="true" skipping inputs when it shouldn't
    • Why was "immediate" attribute added to the EditableValueHolders?

    Unrelated to the concrete problem, make sure you're using up to date resources to learn JSF. Your code is JSF 1.x style while we're already on JSF 2.x since 2009. Start here: https://stackoverflow.com/tags/jsf/info.

    0 讨论(0)
  • 2020-12-20 10:11

    You need :

    • @Named or @ManagedBean annotation on class

    • Scope

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