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
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}" />
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.
You need :
@Named
or @ManagedBean
annotation on class
Scope