;Hi,
I am using JSF 2.0 Mojarra ver. 2.0.2-SNAPSHOT (obtain using maven).
I am trying to use Annotation to setup JSF bean, as such:
@ManagedBean
@RequestScoped
public class HelloBean {
@ManagedProperty(value="test")
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
The annotation does not work, meaning the HelloBean class is not configured as JSF bean. To illustrate this, i have the following page
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<head>
<title>Hello World</title>
</head>
<body>
<f:view>
Hello #{helloBean.name}
</f:view>
</body>
</html>
The name "test" should be printed on the page. But when i run on Tomcat 6.20 and JDK 1.6, the name does not show.
If i use faces-config.xml to configure HelloBean, the name appears correctly on the page.
What have I missed?