日期:2014-05-16 浏览次数:20418 次
{ columnWidth : .5, layout : 'form', border : false, items : [{ name : 'signDate', fieldLabel : '签发时间', labelStyle : "text-align: right;", xtype : 'datefield', format : 'Y-m-d H:i', cls : 'key', allowBlank : true, menu : new DatetimeMenu(), anchor : '90%' }] }
public class WeatherAction extends BaseAction { private String signDate; //签发日期 //////////////////////////////////////////////////////////////// public String getSignDate() { return signDate; } public void setSignDate(String signDate) { this.signDate = signDate; } //////////////////////////////////////////////////////////////////////// /** * */ public void save() throws IllegalAccessException, InvocationTargetException{ ListRange<WeatherInfo> formList = new ListRange<WeatherInfo>(); String message = ""; boolean result = false; WeatherInfo wi = new WeatherInfo();//this.getModelByForm(); BeanUtils.copyProperties(wi, this); wi.setSignDate(DateUtil.getDateFromString(signDate,"yyyy-MM-dd HH:mm"));//按指定格式将String转换为Date LoginUserInfo user = this.getLoginUserInfo(); try{ weatherService.saveOrUpdate(wi,user); result = true; }catch(Exception e){ e.printStackTrace(); message = MessageConstants.ACTION_SAVE_SERVICE_FAILURE; if (e.getCause() instanceof BaseDaoException){ message = MessageConstants.ACTION_SAVE_DB_FAILURE; } } formList.setMessage(message); formList.setSuccess(result); this.outJson(formList); } }