Hi I have two simple wars and one EJB(Enteties and a Farcade). Now I want insert from war 1 to war 2 a entetie class and I'm trying to do like this
War 1:
@ManagedBean
@ConversationScoped
public class Controlador implements Serializable {
@Inject
private Conversation conv;
private Users1 user=new Users1();
private Users2 user2;
private String name;
@EJB
private Users1Facade farcade;
public void start()
{
if(conv.isTransient())
conv.begin();
}
@PostConstruct
public void init()
{
start();
}
public void save() throws IOException
{
farcade.create(user);
FacesContext facesContext = FacesContext.getCurrentInstance();
facesContext.getExternalContext().redirect("/Prueba1/faces/index.xhtml?faces-redirect=true");
}
And my war 2:
@ManagedBean
@ConversationScoped
public class Controlador implements Serializable {
@Inject
private Conversation conv;
@EJB
private com.prueba.session.Users1Facade farcade;
@Inject
private Users1 user;
public void start()
{
if(conv.isTransient())
getConv().begin();
System.out.println(user.getName()+"hola");
System.out.println(user.getApellido()+"Hola");
}
@PostConstruct
public void init()
{
start();
System.out.println(user.getName());
System.out.println(user.getApellido());
}
I want to inject the User was created in war1 to the war2. With the use of EJB and the annotation @Inject. But when I see in the log of war2 it always show me null. null. These wars and the EJB are in a EAR, but it didn't solve my problem. Someway to communicate between these two WARs?
Aucun commentaire:
Enregistrer un commentaire