0

i have a question if it´s possible to use a ManagedBean of project web X in another project web Y that both are in the same Enterprise application?

Any help would be appreciated Thanks.

  • yes, see this link [http://stackoverflow.com/questions/15551372/access-managed-bean-classes-from-a-different-project][1] [1]: http://stackoverflow.com/questions/15551372/access-managed-bean-classes-from-a-different-project – Benjamin RD Jul 08 '13 at 20:29
  • thanks @MrMins ,but i am confused. i have to create face-config in the proyect web Y and add something this: ` mangedBean1 com.package.loginweb.seguridad.myManagedBean1 session myVariable ` it´s right? or need more config in this file? – Cesar Palacios Jul 08 '13 at 21:56
  • in this case not found the class, any idea? – Cesar Palacios Jul 08 '13 at 22:26

1 Answers1

1

Just create a Jar which goes into your final Java EE application (referenced by both of the projects if you're using Maven). Then, add the simplest faces configuration file in your Jar's META-INF directory:

<?xml version="1.0" encoding="UTF-8"?>
<faces-config
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
    version="2.0">
</faces-config>

That will make JSF scan this Jar's content. After that, just use annotations in the classes you want them to be managed beans:

@ManagedBean
@SessionScoped
public class SessionScopedBean{

....

}

That's all, for more info you can visit this link.

Community
  • 1
  • 1
Aritz
  • 30,971
  • 16
  • 136
  • 217