Reputation: 1
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.
Upvotes: 0
Views: 1875
Reputation: 31669
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.
Upvotes: 1