JSP引入页面三种常见错误

来源:互联网 发布:数据库数据类型的理解 编辑:程序博客网 时间:2024/06/04 18:51

JSP引入页面经常出现路径找不到问题

本人今天引入头部文件head.jsp

<%@ include file="${pageContext.request.contextPath}/public/head.jsp" %>

会有小红叉提示

Fragment "/ssim/public/head.jsp" was not found at expected path /ssim/src/main/webapp/ssim/
 public/head.jsp

正确路径应该是

<%@ include file="/public/head.jsp" %>


还有一种错误

用java编程程序运行后出现/1.jsp(9,41) attribute for %>" is not properly terminated 原因是什么呢

标签的page属性值可以是相对路径URL或者<%=表达式 %>,但同时只能存在其中一种


jsp页面加&lt;base href=&quot;&lt;%=basePath%&gt;&quot;&gt;

只要删除<base href="<%=basePath%>"> 这个就好了,页面也不引用它,但是只要在页面加<base href="<%=basePath%>">就是不显示

关于引入页面
 我们都知道在jspinclude有两种形式,分别是
<%@ include file=” ”%>
<jsp:include page=” ” flush=”true”/>
区别:
http://java.chinaitlab.com/ServletJsp/529740_2.html




0 0
原创粉丝点击