各位高手帮忙解决一下啊,谢谢了。
实体类:
@Entity
public class Customer implements Serializable{
private static final long serialVersionUID = -803075682525328610L;
private Integer customerId;
private String loginName;
private String password="123456";
private String nickName;
private String email;
private String cellphone;
@Id @GeneratedValue
public Integer getCustomerId() {
return customerId;
}
}
DAO:
public interface DAO
public void save(Object entity);
}
DAO抽象类:
@Transactional
public abstract class DaoSupport
protected Class
@PersistenceContext protected EntityManager em;
public void save(Object entity) {
em.persist(entity);
}
}
Service层:
public interface CustomerService extends DAO
}
@Service
@Transactional
public class CustomerServiceBean extends DaoSupport
}
Controller层:
@Controller
public class ModiPersonDataController {
@Resource CustomerService customerService;
@RequestMapping("/modiPersonDataUI.do")
public String jumpToModiUI() {
return "modiPersonData";
}
/**
* 修改个人资料和密码
*/
@RequestMapping("/modiPersonData.do")
public void modiPersonData(CustomerForm customerForm){
Customer customer = new Customer();
customer.setLoginName(customerForm.getLoginName());
customer.setPassword(customerForm.getPassword());
customer.setNickName(customerForm.getNickName());
customer.setCellphone(customerForm.getCellphone());
customer.setEmail(customerForm.getEmail());
customerService.save(customer);
}
}
webform层:
public class CustomerForm implements Serializable{
private static final long serialVersionUID = -4425312158083346598L;
private Integer customerId;
private String loginName;
private String password;
private String nickName;
private String cellphone;
private String email;
public String getLoginName() {
return loginName;
}
。。。
}
persistence.xml 配置如下:
beans.xml配置如下:
jdbc.properties)(略)
spring mvc 配置如下:
web.xml 配置如下:
[该贴被zhaome于2010-03-16 16:36修改过]