Unable to create managed bean x. The following problems were found: – Property x for managed bean message does not exist. Check that appropriate getter and/or setter methods exist.
Error Message.
Unable to create managed bean message. The following problems were found: - Property helloWorld for managed bean message does not exist. Check that appropriate getter and/or setter methods exist.
- This message comes in JSF when you are Injecting JSF bean to another Bean using @ManagedProperty.
- Taking below Example of Injecting HelloWorld.java to Message.java
HelloWorld.javapackage com.chillyfacts.com; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; @ManagedBean(name = "hello") @SessionScoped public class HelloWorld { private String name; public HelloWorld() { } public String getName() { return name; } public void setName(String name) { this.name = name; } }
-
There will be error if you just Write like this.
Message.javapackage com.chillyfacts.com; import javax.faces.bean.ManagedBean; import javax.faces.bean.ManagedProperty; import javax.faces.bean.RequestScoped; @ManagedBean @RequestScoped public class Message { @ManagedProperty(value = "#{hello}") private HelloWorld helloWorld; // Any other Code public Message() { } }
-
Solution.
Update the Message.java with Getters and Setters of the bean.
Message.javapackage com.chillyfacts.com; import javax.faces.bean.ManagedBean; import javax.faces.bean.ManagedProperty; import javax.faces.bean.RequestScoped; @ManagedBean @RequestScoped public class Message { @ManagedProperty(value = "#{hello}") private HelloWorld helloWorld; public void setHelloWorld(HelloWorld helloWorld) { this.helloWorld = helloWorld; } public HelloWorld getHelloWorld() { return helloWorld; } // Any other Code public Message() { } }
Error should have gone now.
0 Comments
Comments
Leave a Comment