접기
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%request.setCharacterEncoding("utf-8"); %> <jsp:useBean id="customerDTO" class="myjsp.dto.CustomerDTO" scope="request"/> <jsp:setProperty property="*" name="customerDTO"/> <jsp:forward page="/register"/>
접기
접기
package myjsp.dto;
public class CustomerDTO { private String id; private String password; private String name; private String email; private int age; //생성자, setter/getter, toString, equals, hashCode public CustomerDTO() { super(); // TODO Auto-generated constructor stub } public CustomerDTO(String id, String password, String name, String email, int age) { super(); this.id = id; this.password = password; this.name = name; this.email = email; this.age = age; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } @Override public String toString() { return "CustomerDTO [id=" + id + ", password=" + password + ", name=" + name + ", email=" + email + ", age=" + age + "]"; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + age; result = prime * result + ((email == null) ? 0 : email.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((password == null) ? 0 : password.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; CustomerDTO other = (CustomerDTO) obj; if (age != other.age) return false; if (email == null) { if (other.email != null) return false; } else if (!email.equals(other.email)) return false; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; if (password == null) { if (other.password != null) return false; } else if (!password.equals(other.password)) return false; return true; } }
접기