日期:2014-05-19 浏览次数:21073 次
package com.action;
import com.dto.RegDTO;
import com.opensymphony.xwork2.ActionSupport;
import com.service.RegService;
import com.vo.RegVO;
import freemarker.template.utility.Execute;
public class RegAction extends ActionSupport {
    private RegVO regvo;
    private RegDTO regdto;
    private RegService regservice;
    public String execute() throws Exception {
        // 首先将VO的值传递给DTO
        System.out.println(regvo.getUsername());
        this.populateDTO();
        regservice.RegUser();
        return SUCCESS;
    }
    public void populateDTO() {
        regdto.setUsername(regvo.getUsername());
        regdto.setPassword(regvo.getPassword());
    }
    public RegVO getRegvo() {
        return regvo;
    }
    public void setRegvo(RegVO regvo) {
        this.regvo = regvo;
    }
    public RegDTO getRegdto() {
        return regdto;
    }
    public void setRegdto(RegDTO regdto) {
        this.regdto = regdto;
    }
    public RegService getRegservice() {
        return regservice;
    }
    public void setRegservice(RegService regservice) {
        this.regservice = regservice;
    }
    public static void main(String[] args) throws Exception {
        RegAction sa = new RegAction();
        sa.execute();
    }
}
java.lang.NullPointerException com.action.RegAction.populateDTO(RegAction.java:25) com.action.RegAction.execute(RegAction.java:19) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597)