前台:
new Ext.form.DateField({ id:"jointime", name:"jointime", width:130, fieldLabel:"入会时间", maxValue: new Date(), minValue:"01/01/2001", maxText:"支出日期不能大于{0}", minText:"支出日期不能小于{0}", allowBlank:false, blankText:"入会时间不能为空" })
后台action
public class vipAddAction extends ActionSupport{ private vipDao vipDao; private Vip vip; private String vipname; private int age; private String profession; private Date jointime; private boolean success; private String msg; public String execute() throws Exception{ System.out.println("VIP姓名:"+this.vipname); System.out.println("年龄:"+this.age); System.out.print("职业:"+this.profession); System.out.println("入会时间:"+this.jointime);//打印输出为空 vip=new Vip(this.vipname,this.age this.jointime,this.profession ); if(this.vipDao.vipAdd(this.vip)){ this.success=true; this.msg="添加成功"; }else{ this.success=false; this.msg="添加失败"; } return this.SUCCESS; } }
后来借鉴一个网友的处理:把jointime 设置成String类型,然后再转为Date类型存进数据库
vip=new Vip(this.vipname,this.age,new SimpleDateFormat("D/M/Y").parse(this.jointime),this.profession );
后面竟然还报错:
Illegal pattern character