jsp页面使用表达式跳转报错:
index.jsp
<body>
<jsp:forward page="<%=basePath%>/json" />
</body>
错误信息:
org.apache.jasper.JasperException: /index.jsp(24,26) attribute for %>" is not properly terminated
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:132)
正确写法:
<body>
<!-- json是servlet url -->
<jsp:forward page="${basePath}/json" />
<jsp:forward page="/json" />
</body>
原因:
<jsp:include>标签是允许包含动态和静态页面,其中page属性:
page="{relativeURL | <%= expression %>}"
可以使用绝对路径或相对路径,差别就是绝对路径不以"/"开头,而相对路径是以"/"开头,"/"则代表了项目的路径(到WebRoot根路径下)。
还有<%=path %>其中的path所指的路径末尾没有"/",所以你的路径改为
<jsp:include flush="true" page="<%=path%>/SessLoginServlet"></jsp:include>应该就可以了
=================================================================
<jsp:include page="<%=uri %>/include.jsp"></jsp:include>
报错:attribute for %>" is not properly terminated
原因:标签的page属性值可以是相对路径URL或者<%=表达式 %>,但同时只能存在其中一种
<jsp:include page="/frame/include.jsp"></jsp:include> 表示绝对路径
<jsp:include page="frame/include.jsp"></jsp:include> 表示相对路径
<jsp:include page="<%=uri %>"></jsp:include> 两个引号与<%=uri %>之间不能有空格
===============================================================
<jsp:include page="<%=uri %>/include.jsp"></jsp:include>
报错:attribute for %>" is not properly terminated
原因:标签的page属性值可以是相对路径URL或者<%=表达式 %>,但同时只能存在其中一种
<jsp:include page="/frame/include.jsp"></jsp:include> 表示绝对路径
<jsp:include page="frame/include.jsp"></jsp:include> 表示相对路径
<jsp:include page="<%=uri %>"></jsp:include> 两个引号与<%=uri %>之间不能有空格
参考:
jsp:forward 百度百科:
http://baike.baidu.com/view/1002655.htm
http://jameswsz.iteye.com/blog/1484649
http://hi.baidu.com/hehexiaoyou/item/c5569dc23490a22ea1b50a78