读书人

struts1.x中 formbean不支持Date的解决

发布时间: 2012-10-26 10:30:58 作者: rapoo

struts1.x中 formbean不支持Date的解决办法

只需要在formbean中加入:

static{ConvertUtils.register(new DateConverter(),Date.class);}

?

如:public class TTextForm extends ActionForm {
?
?static{ConvertUtils.register(new DateConverter(),Date.class);}
?
?private Long holidayId;
?private String? holidayName;
?private Date dateStart;
}

?

2.给添加的页面初始化值

public class WorkForm extends ActionForm {

?

private String logStyle="POINT";//默认值

?

3.用js给select添加值:

<html:select property="planId" size="2" styleId="myplans" multiple="true">
??????????????????? ?</html:select>

?

var plans=document.getElementById("myplans");

plans.options.add(new Option("text", "value"));

?

var plen=plans.length; 获取个数

?

plans.options.remove(plans.options[0]); 移去第一个option

读书人网 >软件架构设计

热点推荐