NutzCN Logo
问答 关于FORM提交参数自动实例化对象,其中字段为日期问题。
发布于 3111天前 作者 qq_18cbf901 2417 次浏览 复制 上一个帖子 下一个帖子
标签:

我有一个POJO对象 Project
里面有个日期输入 Date stime

form表单提交方式:

提交的时候,发送报文如图:
22_jpg
时间是:2016-05-29 14:54:31

提交到服务器后,服务器接收代码是:
public View create(HttpServletRequest req,
@Param("::p.")Project p)

但是我直接打印p对象,结果是:
{
"stime" :"2016-05-30 14:54:31"
}

怎么会自动加上一天了?另外,选其他时期没有问题,就是选29号,就会自动加上一天。

有遇到同样问题的没?

4 回复

哪个版本? 整个pojo也贴一下

版本:nutz-1.b.50-jdk6.jar
POJO类

@Table("kee_project")
public class Project {
@Id
public int id;
public String code;
public String conum;
public int cid;
public String title;
public String summary;
public String content;

public double amount;
public double tamount;
public double lamount;
public int lcount = 1;
public int rtype;
public String usetype = "";
public int period = 0;
public int periodtype = 0;
public int vday;
public double rate;
public double addrate;
public double mint;
public double maxt;
public int bmid;
public String bmname = "";
public String bmsg = "";
public int dbmid;
public String dbmname = "";
public String dbmsg = "";
public String dbhan = "";
public String dbcode = "";
public String dbcode2 = "";
public String dbhan2 = "";
public Date ctime;
public Date dtime;//投标完成时间
public Date stime;
public Date etime;
public Date cltime;
public Date dqtime;
public int status;

public int rzr_confirm;
public int db1_confirm;
public String db1_remark;
public int db2_confirm;
public String db2_remark;


public double rate_dbgs;
public String rate_fws;
public double rate_pt;
public double rate_jjr;
//活动费用参数
public String rate_hd;

public String bank_product_id = "";
public String bank_account_no = "";
public String bank_account_name = "";

public String exch_orderno = "";
public String exch_flow_no = "";
public String exch_status = "";
public String exch_remark = "";

public String targeted = "";

public int create_uid;
public int public_uid;
public int confirm_uid;
public int repay_uid;

public int flag;

public int sort;

public int exflag;

public int gjflag;  

}

只要是日期字段,选择29号就会出现这个问题,其他时间没有这个问题。

恩恩,我测试一下

我做了个测试:

页面

<form action="${base}/demo/param/mydate" method="post">
	<input name="mydate" value="2016-05-29 11:59:00">
		<input type="submit">
</form>

入口方法

@At("/demo")
public class DemoModule {

    @At("/param/mydate")
    public void mydate(@Param("..")P p) {
        System.out.println(Json.toJson(p));
    }
    
    public static class P {
        public Date mydate;
    }
}

输出

{
   "mydate" :"2016-05-29 11:59:00"
}

添加回复
请先登陆
回到顶部