How does JSF2.0 bind managed Beans to xhtml?
I have a very simple question about how does JSF2.0 bind Managed Beans to xhtml?
let's say I have an inputtext with value = "# {MymanagedBean.property}"
how is this MymanagedBean reference resolved in JSF 2?
consider the following points when responding.
-
in the ealier version, that is, with JSF 1.2, we have to write the binding in faces-config.xml but with JSF 2 it is not necessary to have faces-config.xml
-
If you browse the source of the xhtml pages you will not find the MymanagedBean reference.
how is it done?
a source to share
in the ealier version, that is, with JSF 1.2, we have to write the binding in faces-config.xml, but with JSF 2, it is not necessary to have faces-config.xml
In JSF2, this is done using annotation @ManagedBean
.
@ManagedBean
public class MymanagedBean {
// ...
}
During Webapp startup, JSF scans the classpath for all classes using this annotation and collects them in memory.
if you browse the source of the xhtml pages .. you will not find MymanagedBean links.
It is right. JSF runs on the server, creates an HTML page (X), and the web server sends it to the web browser. The web browser has no concept of JSF or any other server side languages. Webbrowser only understands HTML, CSS and JavaScript.
a source to share