巧用实体类中的get,set方法

//未写完,待续。。。。

//应用实例

private Date beginDate;

private Date endDate;

public Date getBeginDate(){

  return bgeinDate;

}

public Date setBgeinDate( Date beginDate){

  this.beginDate = beginDate;

}

public Date getEndDate(){

  return endDate;

}

public Date setEndDate( Date endDate){

  this.endDate = endDate;

}

//自定义日期工具类DateUtil 类型DateUtil.DATE_FORMAT_yyyyMMdd

//巧用get,set方法

public String getBeginDateStr(){

  String date = "";
  if (null != getBeginDate()) {
    date = DateUtil.convertDateToString(getBeginDate(), DateUtil.DATE_FORMAT_yyyyMMdd);
  }
  return date;

}

public void setBeginDateStr(String value){

  if(null != value && "".equals(value)){

    setBgeinDate(DateUtil.convertStringToDate(value, DateUtil.DATE_FORMAT_yyyyMMdd));

  }

}

//巧用get,set方法

public String getEndDateStr(){

  String date = "";
  if (null != getEndDate()) {
    date = DateUtil.convertDateToString(getEndDate(), DateUtil.DATE_FORMAT_yyyyMMdd);
  }
  return date;

}

public void setEndDateStr(String value){

  if(null != value && "".equals(value)){

    setEndDate(DateUtil.convertStringToDate(value, DateUtil.DATE_FORMAT_yyyyMMdd));

  }

}

jsp:

<input type="text" id="beginDate" autocomplete="off" class="width-p40" value="${feeVO.tbBeginString}" name="beginDateStr"/>
<input type="text" id="endDate" autocomplete="off" class="width-p40" value="${feeVO.tbEndString}" name="endStr"/>

posted @ 2018-01-10 23:13  ぃSolitary_boy  阅读(2883)  评论(0编辑  收藏  举报