解决ftl中input标签日期格式显示问题

本文介绍了一种使用特殊标记来防止日期变量为空时显示问题的方法。通过设置日期时间格式,可以确保即使变量为空也能正常显示,避免了因空值导致的应用异常。

方法1:

<#setting datetime_format="yyyy-MM-dd HH:mm:ss"/>

${(rmbsClaim.startdate?string('yyyy-MM-dd hh:mm:ss'))!}  !防止rmbsClaim.startdate为空不能显示问题

请分析下面代码:<#setting datetime_format="yyyy-MM-dd"/> <#import "/decorators/includes/macros.ftl" as m> <#assign ww = JspTaglibs["/WEB-INF/webwork.tld"] /> <#include "/template/includes/actionerrors.ftl"> <link type="text/css" rel="StyleSheet" href="../css/sortabletable.css"/> <div id="breadcrumbs"> <a href="${req.contextPath}/index.action">Home</a> > Unlock List </div> <center><font color="red" size="2"><b>MES Product Id version mismatch with your RunCard! <br>So system lock RunCard and waiting for your confirmation. <br>You can unlock the RunCard and then revise the RunCard.</b></font></center> <div class="app"> <font color="red">${message?if_exists}</font> <h3>Unlock List</h3> <table border="0" cellspacing="2" cellpadding="3" width="100%" id="unlockList"> <thead> <tr> <th>Case No</th> <th>Applicant</th> <th>Lot Id</th> <th>Product Id</th> <th>Status</th> <th>Remark</th> <th>Action</th> </tr> </thead> <tbody> <#if lockRuncard?has_content> <#list lockRuncard as lock> <tr class="b"> <@ww.form name="'lockForm${lock_index}'" action="'unlockRuncard'" namespace="'/user'" validate="'true'" method="'post'" theme="'simple'"> <@ww.hidden name="'requestFormId'" value="'${lock.id?if_exists}'"/> <td><a href="../user/viewRequestForm.action?requestFormId=${lock.id}">${lock.caseNo?default("Not Assigned")?if_exists}</a></td> <td><@m.directoryLink lock.applicant?if_exists/></td> <td>${lock.lotId?if_exists}</td> <td>${lock.prodId?if_exists}</td> <td>${lock.status?if_exists}</td> <td width="10%"><@ww.textarea name="'remark'" id="remark${lock_index}" cols="35" rows="3" theme="'simple'" required="true"/></td> <td> <input type="button" onclick="checkRemark(${lock_index})" value=" Pass "> <#--| <input type="button" onclick="javascript:if(confirm('Are you sure?'))location.href='withdrawLockRuncard.action?requestFormId=${lock.id}'" value="Withdraw"--> </td> </@ww.form> </tr> </#list> <script type="text/javascript"> var st0 = new SortableTable(document.getElementById("unlockList"), ["String", "String" ,"String" ,"String"]); function checkRemark(index){ var reg=/\s/g; //var realValue=$F('remark').replace(reg,""); var realValue=$F('remark'+index).replace(reg,""); if(realValue==""){ alert("Please input the remark !"); return false; } if(!confirm('Product Id version mismatch! You confirm ok and need unlock RunCard?')) return false; $('lockForm'+index).submit(); } </script> <#else> <tr colspan="6"> <td> No related result.</td> </tr> </#if> </tbody> </table>
最新发布
09-09
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值