混淆使用JSF2 + Spring + EJB3或它们的任意组合让我感到有些困惑.我知道Spring的一个主要特性是依赖注入,但是我可以使用JSF托管bean @ManagedBean和@ManagedPropertyanotations,并获得依赖注入功能.使用EJB3,我更加困惑何时将其与JSF一起使用,或者甚至有理由使用它.
那么,在什么样的情况下使用Spring + JSF2或EJB3 + JSF2是个好主意?
到目前为止,我只使用JSF2创建了一些小型Web应用程序,从不需要使用Spring或EJB3.但是,我在许多地方看到人们正在将所有这些东西放在一起.
我有一个一行的数据表,我需要编辑这一行的字段,所以我有一些带有值的 inputText,但是当我编辑它们并单击命令按钮(调用方法“actualizarUsuario”时,这些值作为空值。
这是我的豆代码:
@ManagedBean(name = "user")
@ViewScoped
public class userDetalles implements Serializable {
private Usuario u;
private usuarioController controlador;
Rol rol;
private long selection;
private long selectionrol;
Agrupacion agrupacion;
private Privilegio privilegio;
private RolController controladorRol;
private ControladorAgrupaciones controladorAgrup;
private String nombres;
private String apellidoP;
private String apellidoM;
private Boolean check;
@PostConstruct
public void init() {
rol= new Rol() ;
u=new Usuario();
agrupacion=new Agrupacion();
privilegio=new Privilegio();
controlador= new usuarioController();
controladorRol=new RolController();
controladorAgrup=new ControladorAgrupaciones();
Usuario u=new Usuario();
FacesContext facesContext = FacesContext.getCurrentInstance();
ExternalContext …Run Code Online (Sandbox Code Playgroud)