jsp有关异常

来源:互联网 发布:android实时更新数据 编辑:程序博客网 时间:2024/06/07 18:07

jsp 有关异常

1.JSP 使用<%@include%>报Duplicate local variable path 错误 解决方法


<%@ include file="two.jsp" %>

错误提示:

Multiple annotations found at this line:
 - Duplicate local variable path
 - Duplicate local variable 
  basePath

重复变量,

因为<%@include%>引进的是代码,把代码包含进来,而新进JSP时,会默认生成

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

    <base href="<%=basePath%>">

这二句代码,所以用<%@include%>引进页面是就报重复变量 basePath

解决方法,把要引进页面这句去掉就行。


0 0
原创粉丝点击