Rumah  >  Artikel  >  hujung hadapan web  >  ftl找不到JS路径,试了几种方法都不对_html/css_WEB-ITnose

ftl找不到JS路径,试了几种方法都不对_html/css_WEB-ITnose

WBOY
WBOYasal
2016-06-21 08:50:211901semak imbas

<%String path = request.getContextPath();%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">	<html>	  <head>          <title>login.html</title>	    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">	    <meta http-equiv="description" content="this is my page">	    <meta http-equiv="content-type" content="text/html; charset=UTF-8">	    <script type="text/javascript" src="${path}/emos/activeManage/js/Calendar3.js"></script>	    <link href="${path}/common/activeCss/stylee.css" rel="stylesheet" type="text/css" />	    <script type="text/javascript">   	   function date(){	    var myDate = new Date();	    myDate.toLocaleDateString();	    var result=myDate.getFullYear()+'-'+(myDate.getMonth()+1)+'-'+myDate.getDate();	    return result;	    }	    window.onload=function(){		document.getElementById("dateStart").value=date();		document.getElementById("dateCreate").value=date();		document.getElementById("dateEnd").value=date();		document.getElementById("dateLast").value=date();	}	    var areaArrayFa = function(obj){	    var regNum=/^[0-9]*$/;	    var ipt=obj.split(",");	    var numString="";	    var charString="";	for(var i=0;i<ipt.length;i++){ 	    if(regNum.test(ipt[i])){		if(numString==""){		  numString=ipt[i];		}else{		   numString+=","+ipt[i];		}    	    }	    else{  		if(charString==""){		   charString=ipt[i];		}else{		    charString+=","+ipt[i];		}		} 		  }		 document.getElementById("action").value=numString;		 document.getElementById("activeArea").value=charString;	}   	    function select() {  	      window.open ('"/common/ftl/area.ftl', 'newwindow', 'height=300, width=500, top=100,left=950, toolbar=no,menubar=no, scrollbars=no, resizable=no,location=no, status=no');	     }	 	function addActive(){ 	 	 		var form = document.forms[0];			form.action = "/emos-dms/active/addactive.htm";			form.method="post";			form.submit();  		}  		function serActive() {			window.open( '/emos-dms/active/list.do', 'newwindow', 'height=500, width=500, top=100,left=950, toolbar=no,menubar=no, scrollbars=no, resizable=no,location=no, status=no');		}		var activeArrayFa = function(serc) { 			document.getElementById("serchId").value = serc;		} 	</script> 	 	  </head>	  <body>	 	<div class="register span6"  id="head">		<!--   <form action="/emoss/active/addactive.do" name="activeForm" method="post">  	 -->	  <form action="active_*" name="activeIndex*" method="post">	 <h2>活动信息 </h2> 	<table id="guimo" align="center">	<tr>	 <td><input type="hidden" name="area1" id="action"><td>	</tr>	<tr>	<td>活动编码: </td>   <td><input type="text" name="activeCode" id="activeCode">    </td>	<td>活动名称:</td>	<td><input type="text" name="activeName"></td>	</tr>	<tr>	<td>活动说明:</td>	<td><input type="text" name="activeDesc"></td>	<td>移动编码:</td>	<td><input type="text" name="serviceId" ></td>	</tr>	<tr> 	<td>活动时长:</td>	 <td><input type="text" name="activePeriod"   placeholder="单位: 月"></td>	<td>开始时间:</td>	<td><input type="text" name="activeStartDate" id="dateStart"  		onClick="new Calendar().show(this);"  class="text-order"></td>	</tr>	<tr>	<td>结束时间:</td>	<td><input type="text" name="activeEndDate" id="dateEnd"  		onClick="new Calendar().show(this);"   class="text-order"></td>	<td>活动类型:</td>	<td><select name="activeType" onChange="look()" id="typt" style="width:100%;height:30px">			<#list activeTypeDto as ac>			<option value="${ac.paramName}"> ${ac.paramValue}</option>			 </#list>		</select>	</td>	</tr>	<tr>	<td>活动状态:</td>	<td><input type="text" name="activeStatus" value="正常"></td>	<td>父活动编码:</td>	<td><input type="text" name="parActiveId"  id="serchId" onclick="serActive()"></td>		</tr>	<tr>	<td>创建时间:</td>	<td><input type="text" name="createdDate" id="dateCreate"  		onClick="new Calendar().show(this);" class="text-order"></td>	<td>创建人:</td>	<td><input type="text" name="createdBy"></td>	</tr>	<tr>	<td>最后修改时间:</td>	    <td><input type="text" name="lastUpdatedDate"  id="dateLast"		onClick="new Calendar().show(this);"  class="text-order"></td>   	<td>最后修改人:</td>	<td><input type="text" name="lastUpdatedBy"></td>	</tr> 	 </table>	   <div id="area">	 活动地区: 	 <button type="button" onclick="select()">查询</button> 	<!--  <input type="button" name="submit" value="查询" onclick="select();"> --><br />	 <div id="area_text">	     <textarea id="activeArea" name = "activeArea" rows="5" cols="50" ></textarea> </div>	 </div><br/>	 <center>	<input type="reset" name="reset" value="重置"/>	        	<input type="submit" name="submit" value="提交" onclick="addActive();"/>	</center> 	</form>	</div>	</body>	</html>


回复讨论(解决方案)

1: 用 ${pageContext.request.contextPath} 指向项目的根目录

2: 配置参数+html base

在web.xml中
  
    domain
    域名或ip
  


在html中
nbsp;html>




...


js,css都用相对路径,例:

这时core.css 指南 domain+"/style/core.css"
Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn