Calendar的时间设定分开成year,month,date等

来源:互联网 发布:淘宝部分退款 编辑:程序博客网 时间:2024/05/18 01:04

/priceBacks.do?method=Parentpayfeeviewall&fromflag=left  //传入的方法后定义了一个临时的属性=left
String fromflag=request.getParameter("fromflag");
if("left".equals(fromflag)){
 this.removeActionFormFromScope(request,mapping);  //清空request
 parentpayfeeForm.clear();     //清空Form
 Calendar c=Calendar.getInstance();    //Calendar是抽象类,用里面的方法getInstance(),得到实例化,相当于普通类的new得到实例化
 c.setTime(new Date());      //设定时间
 String year=c.get(c.YEAR)+"";     //得到时间并且转型成String类型
}


//清楚request的方法
protected void removeActionFormFromScope(HttpServletRequest request,ActionMapping mapping){
 if("request".equals(mapping.getScope())){
  request.removeAttribute(mapping.getAttribute());
 }else if{
  request.getSession().removeAttribute(mapping.getAttribute());
 }
}


//Form里的清零方法
public void clear(){
 this.id=null;
 this.month=null;
 this.parentid=null;
 this.parentname=null;
 this.banknumber=null;
 this.nowmonthpayfee=null;
 this.nopayfee=null;
 this.changefee=null;
 this.nextmonthpayfee=null;
 this.nowpayfee=null;
 this.paystate=null;
 this.remark=null;
}

原创粉丝点击