您的位置:首页 > Web前端 > JavaScript

JSP页面上时间显示问题

2016-01-21 17:35 489 查看
在表格中显示操作时间,通过script实现同一表格栏下显示不同状态的时间:

<span style="font-size:18px;"><ww:if test="${alarmAssginLevel =='p'}">
<ec:column property="taskAssignStatusCN"  title="下发状态" width="10%" sortable="false"></ec:column>
<ec:column property="taskSendTime" title="下发时间" sortable="false" width="8%" cell="datetime" format="yyyy-MM-dd HH:mm"></ec:column>
</ww:if>
<ww:if test = "${alarmAssginLevel =='q'}">
<ec:column property="taskFeedbackStatusCN"  title="反馈状态" width="12%" sortable="false"/>
<ec:column property="time" title="操作时间" sortable="false" width="8%" >
<span style="white-space:pre">	</span><script>
<span style="white-space:pre">	</span>if(${alarm.taskFeedbackStatus=='1'}){
<span style="white-space:pre">	</span>document.write('签收时间:${alarm.taskSignedTimeStr}');
<span style="white-space:pre">	</span>}else if(${alarm.taskFeedbackStatus=='3' || alarm.taskFeedbackStatus=='4'}){
<span style="white-space:pre">	</span>document.write('拒绝时间:${alarm.taskRefusedTimeStr}');
<span style="white-space:pre">	</span>}
<span style="white-space:pre">	</span></script>
<span style="white-space:pre">	</span></ec:column>
</ww:if></span>


由于数据库中存储的是taskRefusedTime taskSignedTime 是Date型,在页面显示直接调用会格式有问题,因而我们在页面读取的时候是taskSignedTimeStr
taskRefusedTimeStr(String),单独在相应的java文件和过滤器中定义String类.最后在对应的SQL中进行设置,将Date型转为String型。

to_char(t.TASK_SIGNED_TIME,'yyyy-MM-dd HH24:mi') as taskSignedTimeStr,
<span style="white-space:pre">	</span>to_char(t.TASK_REFUSED_TIME,'yyyy-MM-dd HH24:mi') as taskRefusedTimeStr,


系统框架为SSI
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: