Java Reference
In-Depth Information
The value of the <managed-bean-name> element matches the value we entered in the
Class Name field in the wizard. Notice that this value is what we used in the value
binding expressions in our page to access the managed bean properties. Although
the value we gave the managed bean matches it's class name, this is not mandatory.
The value we entered in the wizard's Class Name field is also used as the name
of the class that was generated by the wizard, as can be seen by the value of the
<managed-bean-class> element, which is the fully qualified name of our managed
bean class. Unsurprisingly, the package structure matches the value we entered in
the Package field in the wizard. Finally, we see the scope we selected in the wizard
as the value of the <managed-bean-scope> element.
At this point, we need to modify our managed bean by adding properties that will
hold the user-entered values.
Automatic Generation of Getter and Setter Methods
Netbeans can automatically generate getter and setter methods for our
properties. We simply need to click the keyboard shortcut for "insert
code", which defaults to Alt+Insert in Windows and Linux, then select
Getters and Setters .
package com.ensode.jsf.managedbeans;
public class RegistrationBean {
/** Creates a new instance of RegistrationBean */
public RegistrationBean() {
}
private String salutation;
private String firstName;
private String lastName;
private Integer age;
private String email;
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
 
Search WWH ::




Custom Search