Java Reference
In-Depth Information
13 </h:form>
14 </h:body>
15 </html>
L ISTING 33.19
AddressRegistrationJSFBean.java
1 package jsf2demo;
2
3 import javax.inject.Named;
4 import javax.enterprise.context.SessionScoped;
5 import java.sql.*;
6 import java.io.Serializable;
7
8 @Named(value = "addressRegistration")
9 @SessionScoped
10 public class AddressRegistrationJSFBean implements Serializable {
11
managed bean
session scope
private String lastName;
property lastName
12
private String firstName;
13
private String mi;
14
private String telephone;
15
private String email;
16
private String street;
17
private String city;
18
private String state;
19
private String zip;
20
private String status = "Nothing stored" ;
21
// Use a prepared statement to store a student into the database
22
private PreparedStatement pstmt;
23
24
public AddressRegistrationJSFBean() {
25
initializeJdbc();
initialize database
26 }
27
28
public String getLastName() {
29
return lastName;
30 }
31
32
public void setLastName(String lastName) {
33
this .lastName = lastName;
34 }
35
36
public String getFirstName() {
37
return firstName;
38 }
39
40
public void setFirstName(String firstName) {
41
this .firstName = firstName;
42 }
43
44
public String getMi() {
45
return mi;
46 }
47
48
public void setMi(String mi) {
49
this .mi = mi;
50 }
51
52
public String getTelephone() {
53
return telephone;
54 }
 
 
Search WWH ::




Custom Search