我的jsp页面:<tr>
<td height="49">
计费日期:
</td>
<td>
<label>
<html:text property="jfstdate"></html:text>
</label>
</td>
<td colspan="2">
合同生效日:
</td>
<td>
<label>
<html:text property="contectstart"></html:text>
</label>
</td>
<td>
合同终止日:
</td>
<td colspan="2">
<label>
<html:text property="contectend"></html:text>
</label>
</td>
</tr>
<td>
合同签订日:
</td>
<td>
<label>
<html:text property="contectdate"></html:text>
</label>
</td>hibernate的映射如下: <property name="jfstdate" type="java.util.Date">
<column name="jfstdate" length="19"/>
</property>
<property name="contectstart" type="java.util.Date">
<column name="contectstart" length="19"/>
</property>
<property name="contectend" type="java.util.Date">
<column name="contectend" length="19" />
</property>
<property name="contectdate" type="java.util.Date">
<column name="contectdate" length="19"/>
</property>我的action如此写的:SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
jc.setContectdate(sdf.parse((String) f.get("contectstart")));
jc.setContectdate(sdf.parse((String) f.get("contectend")));
jc.setContectdate(sdf.parse((String) f.get("jfstdate")));
jc.setContectdate(sdf.parse((String) f.get("contectdate")));
但是插入数据库的时候,却只有jc.setContectdate(sdf.parse((String) f.get("contectdate")));对应的字段有值并且是对的,其余的三个都是NULL,为什么呢?另外问一下如何在mysql数据库中设置字段为timestamp类型时,指定只是有yyyy-MM-dd?
<td height="49">
计费日期:
</td>
<td>
<label>
<html:text property="jfstdate"></html:text>
</label>
</td>
<td colspan="2">
合同生效日:
</td>
<td>
<label>
<html:text property="contectstart"></html:text>
</label>
</td>
<td>
合同终止日:
</td>
<td colspan="2">
<label>
<html:text property="contectend"></html:text>
</label>
</td>
</tr>
<td>
合同签订日:
</td>
<td>
<label>
<html:text property="contectdate"></html:text>
</label>
</td>hibernate的映射如下: <property name="jfstdate" type="java.util.Date">
<column name="jfstdate" length="19"/>
</property>
<property name="contectstart" type="java.util.Date">
<column name="contectstart" length="19"/>
</property>
<property name="contectend" type="java.util.Date">
<column name="contectend" length="19" />
</property>
<property name="contectdate" type="java.util.Date">
<column name="contectdate" length="19"/>
</property>我的action如此写的:SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
jc.setContectdate(sdf.parse((String) f.get("contectstart")));
jc.setContectdate(sdf.parse((String) f.get("contectend")));
jc.setContectdate(sdf.parse((String) f.get("jfstdate")));
jc.setContectdate(sdf.parse((String) f.get("contectdate")));
但是插入数据库的时候,却只有jc.setContectdate(sdf.parse((String) f.get("contectdate")));对应的字段有值并且是对的,其余的三个都是NULL,为什么呢?另外问一下如何在mysql数据库中设置字段为timestamp类型时,指定只是有yyyy-MM-dd?
解决方案 »
- struts1.X多个action
- The requested resource () is not available.验证码登录后出现的异常,是怎么回事?
- h:panelGrid 对齐问题,在线等待
- Math函数的问题
- 求一个实用的hibernate分页代码或请帮我看看我的分页哪里有错误,急,在线等待!
- 新闻发布如何实现
- 一个多选择的列表框listbox怎么得到它所有的值,无论有没有选择上?
- 哪有jdbc的sqlserver2000的驱动,以及sybase11.9的jdbc驱动下载
- 请问谁有水晶报表有关java开发的资料,高分求购
- 如何在JSP中实现:让用户绘制工作流程图的功能,请大家都来讨论。
- Struts 大型站点页面布局问题
- 问一个有关面向对象封装的问题
System.out.println(sdf.format(sdf.parse((String) f.get("contectstart"))));
并且是正确的,但是插入数据库的时候里面却是NULL。
jc.setContectdate(sdf.parse((String) f.get("contectend")));
jc.setContectdate(sdf.parse((String) f.get("jfstdate")));
jc.setContectdate(sdf.parse((String) f.get("contectdate")));
你不是把2个值赋给一个属性了吗 所以数据库中只有Contectdate这个有值