bean:
public class _card
{
protected java.util.Date _offDate;
/**
* 获得过期日期
*/
public java.util.Date getOffDate()
{
return _offDate;
}
/**
* 设置过期日期
*/
public void setOffDate(java.util.Date value)
{
_offDate = value;
}
}
public class card extends _card
{
/**
* 格式化时间格式
*/
public String getOffDateString()
{
SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");
if (null != this.getOffDate())
{
return df.format(this.getOffDate());
}
else
{
return "";
}
}
}
前端JSP使用:
<td><input type="text" name="offDate" class="editTextbox" value="${item.offDateString }" /> --录入格式为“20110101”代表2011年1月1日</td>