package javaeetutorial.hello1;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
@Named
@RequestScoped
public class Hello {
private String name;
public Hello() {
}
public String getName() {
return name;
}
public void setName(String user_name) {
this.name = user_name;
}
}
首先引入注解包,分别为Named和requestScoped接口
Named 可绑定多个实现,RequestScoped指定实现类的作用域
然后就是实现类的三个方法,私有成员变量
构造函数,获取和设置成员变量