.inc 文件顾名思义是include file的意思。 实际上,文件的后缀对于文件包含是无所谓;你可以包含一个asp文件,也可以包含txt文。 一般我们使用 inc作为后缀,是因为这样能体现该文件的作用。
.inc文件的作用有点类似于C/C++内的.H .HPP头文件,使用inc文件可以使我们的程序,增加可读性,更易于开发和维护。
example:一个header.inc文件,里面引用了一些标签库和路径
<%@taglib prefix="s" uri="/struts-tags"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%String contextPath = request.getContextPath();%>
<%String importURL = "http://tupian.focusedu.cn"; %>
<%
//Back
//String keImageUploadJsonBackAction = "http://tp.highso.cn:8080/upload!img.action";// Online Address
String keImageUploadJsonBackAction = contextPath + "/dis/uploadBack!img.action";// Local Address
//Front
//String keImageUploadJsonAction = "http://tp.highso.cn:8080/upload!img.action";// Online Address
String keImageUploadJsonAction = contextPath + "/dis/upload!img.action";// Local Address
%>
然后在jsp页面head 和 body里就可以直接使用
<script type="text/javascript" src="<%=contextPath%>/back/script/jquery-1.3.2.js"></script>