I have a problem with JSF 2.2 and CDI, my managerbean is not solved and this error appear
"value="#{userBean.user.name}": Target Unreachable, identifier 'userBean' resolved to null"
This is my manager bean.
@ManagedBean
@RequestScoped
public class UserBean implements Serializable {
private User user;
public void setUser(user) {
this.user = user;
}
...
}
My view is:
<h:form id="login-form">
<h:outputText value="User"/>
<h:inputText value="#{userBean.user.name}" id="username"/>
<h:outputText value="Senha"/>
<h:inputSecret value="#{userBean.user.password}" id="pasword"/>
<h:commandButton id="button" value="Login" action="#{userBean.login}"/>
<h:messages />
</h:form>
I want to share my experience with this Exception. My JSF 2.2 application worked fine with WildFly 8.0, but one time, when I started server, i got this "Target Unreacheable" exception. Actually, there was no problem with JSF annotations or tags.
Only thing I had to do was cleaning the project. After this operation, my app is working fine again.
I hope this will help someone!
You need
@ManagedBean(name="userBean")
Make sure you have getUser()
method.
Type of setUser()
method should be void
.
Make sure that User
class has proper setters
and getters
as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With