开始时单独导入到jsp的空白页面,时间的函数可以发挥作用,代码如下:
<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01Transitional//EN"><%@pagelanguage="java"import="java.util.*"pageEncoding="UTF-8"%><%Stringpath=request.getContextPath();StringbasePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><html><head><title>My97date</title><scripttype="text/javascript"src="My97DatePicker/WdatePicker.js"></script><scripttype="text/javascript"src="js/jquery-1.7.2.js"></script></head><body><form><inputid="sdate"class="Wdate"οnfοcus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,maxDate:'#F{$dp.$D(\'edate\')}'})"/>-<inputid="edate"class="Wdate"οnfοcus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,minDate:'#F{$dp.$D(\'sdate\')}',startDate:'#F{$dp.$D(\'sdate\',{d:+1})}'})"/><br><br><inputtype="text"id="time"class="Wdate"οnfοcus="WdatePicker({lang:'zh-cn',dateFmt:'yyyy-MM-dd'})"/></form><scripttype="text/javascript">$(function(){$("#time").blur(function(){vartime=$(this).val();if(time==""){alert("请选择时间");}});});</script>上面的代码可以正常显示时间的格式
实际用到的页面为:
<%@pagelanguage="java"import="java.util.*"pageEncoding="UTF-8"%><%@taglibprefix="s"uri="/struts-tags"%><%Stringpath=request.getContextPath();StringbasePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01Transitional//EN"><html><head><basehref="<%=basePath%>"><title>MyJSP'info.jsp'startingpage</title><metahttp-equiv="pragma"content="no-cache"><metahttp-equiv="cache-control"content="no-cache"><metahttp-equiv="expires"content="0"><metahttp-equiv="keywords"content="keyword1,keyword2,keyword3"><metahttp-equiv="description"content="Thisismypage"></head><body><divclass="action"><divclass="t">申请休假</div><divclass="pages"><formaction="${pageContext.request.contextPath}/attence/addleave.action?usid=<s:propertyvalue='#session.user1.id'/>"method="post"οnsubmit="returncheckAll()"enctype="application/x-www-form-urlencoded"target="_self1"><tablewidth="90%"border="0"cellspacing="0"cellpadding="0"><tr><tdalign="right"width="30%">姓名:</td><tdalign="left"><inputtype="text"οnblur="checkUname()"name="at.aname"id="at.aname"/></td></tr><tr><tdalign="right"width="30%">开始时间:</td><tdalign="left"><inputtype="text"id="sdate"name="at.astarttime"class="Wdate"οnfοcus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,maxDate:'#F{$dp.$D(\'edate\')}'})"/><astyle="color:red">*<spanid="span1"></span></a></td></tr><tr><tdalign="right"width="30%">结束时间:</td><tdalign="left"><inputtype="text"id="edate"name="at.aendtime"class="Wdate"οnfοcus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,minDate:'#F{$dp.$D(\'sdate\')}',startDate:'#F{$dp.$D(\'sdate\',{d:+1})}'})"/><astyle="color:red">*<spanid="span2"></span></a></td></tr><tr><tdalign="right"width="30%">请假天数:</td><tdalign="left"><inputtype="text"name="at.aday"id="aday"/><astyle="color:red">*<spanid="span3"></span></a></td></tr><tr><tdalign="right"width="30%">请假原因:</td><tdalign="left"><textarearows="2"cols="20"id="at.areason"name="at.areason"></textarea></td></tr><tr><tdalign="right"width="30%">审批人:</td><tdalign="left"><selectid="at.lid"name="at.lid"><s:iteratorvalue="#session.userList1"var="user"status="status"><optionvalue="<s:propertyvalue='id'/>"><s:propertyvalue="rname"/></option></s:iterator></select></td></tr><tr><tdalign="center"colspan="2"><br/><inputtype="submit"id="save"value="提交申请"/><inputtype="button"id="return"value="返回"οnclick="window.history.back()"/></td></tr></table></form></div></div></body></html>
红色区域为时间插件可以显示的顺序,之前的顺序css在最前,其次是jQuery和时间的插件,修改后恢复正常,同时当时使用的是MyEclipse,需要重新启动方可正常显示,所以修改之后,要重新启动服务器.