1 package com.netpotlet.cove.bean;
2
3 import java.io.Serializable;
4
5 import javax.faces.component.UIComponent;
6 import javax.faces.context.FacesContext;
7 import javax.faces.event.ActionEvent;
8 import javax.faces.validator.LengthValidator;
9 import javax.faces.validator.ValidatorException;
10
11 public class UserinfoBean implements Serializable {
12 private String email = "";
13 private String password = "";
14 private Integer favorite = new Integer(0);
15 private int minimum;
16 private int maximum;
17 private LengthValidator validator = new LengthValidator();
18
19 public UserinfoBean() {}
20
21 public String getEmail() {
22 return email;
23 }
24
25 public void setEmail(String email) {
26 this.email = email;
27 }
28
29 public Integer getFavorite() {
30 return favorite;
31 }
32
33 public void setFavorite(Integer favorite) {
34 this.favorite = favorite;
35 }
36
37 public String getPassword() {
38 return password;
39 }
40
41 public void setPassword(String password) {
42 this.password = password;
43 }
44
45 public void update(ActionEvent event) {
46 System.out.println("email: "+email);
47 System.out.println("password: "+password);
48 System.out.println("favorite: "+favorite);
49 }
50
51 public int getMaximum() {
52 return validator.getMaximum();
53 }
54
55 public void setMaximum(int maximum) {
56 this.maximum = maximum;
57 }
58
59 public int getMinimum() {
60 return validator.getMinimum();
61 }
62
63 public void setMinimum(int minimum) {
64 this.minimum = minimum;
65 }
66
67 public void validate(FacesContext context,
68 UIComponent component,
69 Object value) throws ValidatorException {
70 validator.setMinimum(minimum);
71 validator.setMaximum(maximum);
72 validator.validate(context, component, value);
73 }
74 }